Page 1 of 1

How to Set on indicator by using Javascript

Posted: Wed Sep 25, 2019 3:11 am
by Ake_Thai
I want to set on indicator by using Javascript at event (onfocus) in Rich Display file, Do you have any function to set on it ?

Thanks in Advance,
Apimook
Developer

Re: How to Set on indicator by using Javascript

Posted: Fri Sep 27, 2019 9:15 am
by Scott Klement
Do you mean that you want to turn on an indicator in your RPG program using JavaScript to set it? If so, the easiest way to do that is to put a hidden button on the screen and bind its "response" property to an indicator. Then from JavaScript you can use the pui.click() function to click the button, and this will set on the indicator.

If you mean you want to set a JavaScript variable rather than one in the RPG program, then this is simply a matter of changing the variable directly.

If you mean Node.js, then please describe the situation in more depth because there are several things you could mean.

Re: How to Set on indicator by using Javascript

Posted: Mon Sep 30, 2019 5:32 am
by Ake_Thai
Dear Mr.Scott Klement

I mean I want to turn on indicator that set in Rich Display File by using JavaScript
Such as, an error indicator in Error condition in textbox , please see my attach file.

Best Regards,
Apimook
Developer

Re: How to Set on indicator by using Javascript

Posted: Mon Sep 30, 2019 10:22 pm
by Scott Klement
The indicators in your example are used only when the screen loads. Changing their values in JavaScript code will not affect the properties they are bound to.

Instead, consider using the pui.errorTip() function to display an error message from JavaScript. Here is a link to the documentation for pui.errorTip: https://docs.profoundlogic.com/x/FYDQ

To change regular properties after the screen has loaded, you can call the applyProperty() function:
https://docs.profoundlogic.com/x/NgAy

Code: Select all

applyProperty("AgreeNo", "set focus", true);
Since the "set focus" property is utilized after the onload event, using an applyProperty() call in the onload event works nicely.

After the onload event, a good way to set focus is with the standard JavaScript focus() function.
https://www.w3schools.com/jsref/met_html_focus.asp

Code: Select all

getObj("AgreeNo").focus();

Re: How to Set on indicator by using Javascript

Posted: Mon Sep 30, 2019 10:57 pm
by Ake_Thai
Thanks for your information Mr.Scott . ^_^

Best Regards,
Apimook
Developer