Page 1 of 1

Problems with External Files defined in the screen record format widget

Posted: Sun Jul 01, 2018 6:49 am
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

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

Posted: Mon Jul 02, 2018 11:09 am
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.

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

Posted: Thu Jul 05, 2018 4:39 am
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