Problems with External Files defined in the screen record format widget

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Jose Manuel
Profound User
Posts: 39
Joined: Mon Aug 21, 2017 11:48 am
First Name: Jose
Last Name: hernandez Guerra
Company Name: CM de gestion y servicios S.L.
Phone: 638489712
Address 1: CL Jose Luis de Cassos 50
City: Sevilla
State / Province: Outside Canada/USA
Zip / Postal Code: 41005
Country: Spain
Contact:

Problems with External Files defined in the screen record format widget

Post by Jose Manuel »

Hi Everyone, my problem is as follows:
I have an RPG program with several screen formats, in one of them I have defined an external file (javascript) that simply makes an alert.
In the first call of the program the javascript is loaded and executed.
Now, if from that screen I call another program that shows other data,
to return to the first program the javascript is no longer loaded and it is not executed.
Does anyone know what can happen ??
Thank you
Scott Klement
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: Problems with External Files defined in the screen record format widget

Post by Scott Klement »

Profound UI does not reload the web page, it simply redraws the part of the screen that is necessary. (This is called a Single Page Application, or SPA in web programming.)

JavaScript can only be loaded once into a web page. Thereafter, it is already loaded, so cannot be loaded again.

It sounds to me like you are running an alert() call when the JavaScript is loaded. Since it can only be loaded once, it will run the first time it is loaded, and not run again.

If you want to load it each time the screen is displayed instead of when the JavaScript is loaded into the page, put the code into a function, and call the function from the screen's "onload' event.
Jose Manuel
Profound User
Posts: 39
Joined: Mon Aug 21, 2017 11:48 am
First Name: Jose
Last Name: hernandez Guerra
Company Name: CM de gestion y servicios S.L.
Phone: 638489712
Address 1: CL Jose Luis de Cassos 50
City: Sevilla
State / Province: Outside Canada/USA
Zip / Postal Code: 41005
Country: Spain
Contact:

Re: Problems with External Files defined in the screen record format widget

Post by Jose Manuel »

We followed your instructions but it did not work with two external files.
Interestingly we have done something that I think is not elegant but that does work.
We define the external script within the widget. We create another external script union of the two but encapsulating them in Functions.
We create within that scritp a function that launches the other two.
I add this external file inside the widget.
in the onload event call us that launching function

Thank you
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests