I see that I can run a JavaScript from OnChange event. Is there a way to run an RPG subroutine (or get it to execute code below Exfmt)? I was thinking about making JavaScript press a hidden button, but don't want to re-invent the wheel if there is a prescribed method.
Thanks!!
Execute Subroutne from OnChange Event
-
- New User
- Posts: 4
- Joined: Mon Jun 25, 2018 11:56 am
- First Name: Max
- Last Name: Valdman
- Company Name: The Hammock Source
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Execute Subroutne from OnChange Event
Hi Max,
Subroutines and code beneath your EXFMT are internal parts of your RPG program. They can only be called from within that program.
The onchange event is JavaScript code that's running inside the web browser. It runs on your PC (Windows, Linux, MacOS, mobile device, or whatever you use to run your browser) so it is running in a different program on a different computer.
What people typically do instead is set the value of a field that gets returned to the RPG program. The most obvious way is to use the "changed" property of the widget to turn on an indicator, and when control is returned to the RPG program, it checks to see if the indicator is on and runs the subroutine.
Of course, that only makes sense if you don't mind waiting until the screen is submitted back to the RPG program. If you need to run code immediately when the field is changed, without submitting the screen, people will typically write that code in JavaScript. If it needs something from the server, it can use an AJAX call to a Universal Display (or a different web service / microservice) to get that information.
Subroutines and code beneath your EXFMT are internal parts of your RPG program. They can only be called from within that program.
The onchange event is JavaScript code that's running inside the web browser. It runs on your PC (Windows, Linux, MacOS, mobile device, or whatever you use to run your browser) so it is running in a different program on a different computer.
What people typically do instead is set the value of a field that gets returned to the RPG program. The most obvious way is to use the "changed" property of the widget to turn on an indicator, and when control is returned to the RPG program, it checks to see if the indicator is on and runs the subroutine.
Of course, that only makes sense if you don't mind waiting until the screen is submitted back to the RPG program. If you need to run code immediately when the field is changed, without submitting the screen, people will typically write that code in JavaScript. If it needs something from the server, it can use an AJAX call to a Universal Display (or a different web service / microservice) to get that information.
-
- New User
- Posts: 4
- Joined: Mon Jun 25, 2018 11:56 am
- First Name: Max
- Last Name: Valdman
- Company Name: The Hammock Source
- Contact:
Re: Execute Subroutne from OnChange Event
Thank you Scott!
I was advised to use pui.click, which combined with changed indicator (like you suggested) does exactly what I need.
Thanks again.
I was advised to use pui.click, which combined with changed indicator (like you suggested) does exactly what I need.
Thanks again.
Who is online
Users browsing this forum: No registered users and 1 guest