How to Set on indicator by using Javascript

Use this board for starting discussions, asking questions, and giving advice on Web programming for the IBM i platform (and predecessors.)
Ake_Thai
New User
Posts: 8
Joined: Mon Sep 23, 2019 5:56 am
First Name: Apimook
Last Name: Siriploypraguy
Company Name: Krungsri Auto PCL.
Phone: 0806043021
Address 1: 412 Prachautit Bangkok Thailand
City: Bangkok
State / Province: Outside Canada/USA
Zip / Postal Code: 10140
Country: Thailand
Contact:

How to Set on indicator by using Javascript

Post 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
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: How to Set on indicator by using Javascript

Post 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.
Ake_Thai
New User
Posts: 8
Joined: Mon Sep 23, 2019 5:56 am
First Name: Apimook
Last Name: Siriploypraguy
Company Name: Krungsri Auto PCL.
Phone: 0806043021
Address 1: 412 Prachautit Bangkok Thailand
City: Bangkok
State / Province: Outside Canada/USA
Zip / Postal Code: 10140
Country: Thailand
Contact:

Re: How to Set on indicator by using Javascript

Post 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
Attachments
example.xlsx
(213.13 KiB) Downloaded 818 times
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: How to Set on indicator by using Javascript

Post 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();
Ake_Thai
New User
Posts: 8
Joined: Mon Sep 23, 2019 5:56 am
First Name: Apimook
Last Name: Siriploypraguy
Company Name: Krungsri Auto PCL.
Phone: 0806043021
Address 1: 412 Prachautit Bangkok Thailand
City: Bangkok
State / Province: Outside Canada/USA
Zip / Postal Code: 10140
Country: Thailand
Contact:

Re: How to Set on indicator by using Javascript

Post by Ake_Thai »

Thanks for your information Mr.Scott . ^_^

Best Regards,
Apimook
Developer
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests