Onkeyup Javascript from RPG

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
livio.daneluzzi
New User
Posts: 6
Joined: Fri Feb 02, 2018 10:13 am
First Name: Livio
Last Name: Daneluzzi
Company Name: Daneluzzi IT
State / Province: Outside Canada/USA
Country: Italy
Contact:

Onkeyup Javascript from RPG

Post by livio.daneluzzi »

Hi to all...

I tried to looking for some answers, but without success, and I decided to aks here:
is it possibile to change the Javascript in onkeyup/onchange/onclick events of a textbox with a Javascript or PUI. command?
I've the commands I need in Javascript, to put in these events, in some variables on the screen (labels).

Thanks
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: Onkeyup Javascript from RPG

Post by Scott Klement »

Sorry, I don't understand the question. Can you give me an example?
livio.daneluzzi
New User
Posts: 6
Joined: Fri Feb 02, 2018 10:13 am
First Name: Livio
Last Name: Daneluzzi
Company Name: Daneluzzi IT
State / Province: Outside Canada/USA
Country: Italy
Contact:

Re: Onkeyup Javascript from RPG

Post by livio.daneluzzi »

Sorry Scott, I hope this will explain better: ;-)
I need to change the ONKEYUP, or ONCLICK, or ONCHANGE event attribute, of a TEXTBOX, with a Javascript command.
I saw there's way to change the attributes of a TEXTBOX in a display file, for example with the command:

setDOMAttribute("TEXTBOX1", "value", "abcdefgh");

and if I use "value" it works perfect, but I need to change, for example, "onclick" attribute, and I thought to modify the command like this one:

setDOMAttribute("TextBox1", "onclick", "some Javascript code");

but it doesn't work. It doesn't change the "onclick" attribute.
Is there a way to do it? Am I using the right command, or is there another one for to do this thing?

Thanks a lot
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: Onkeyup Javascript from RPG

Post by Scott Klement »

I'd never heard of setDOMAttribute() before your message. I looked, and it appears to be part of our software, but I've never heard of it before and never saw anyone use it.

If you want to add your own event handler to Profound UI at runtime, you would use the addEvent() API documented here:
http://www.profoundlogic.com/docs/pages ... Id=3276841

To remove that event handler (prior to adding a different one) you would use the removeEvent() API:
http://www.profoundlogic.com/docs/pages ... Id=3276843

Please note that if you're adding/removing events like this you are working at the DOM level, so you must only use this with browser events, not anything that's specific to Profound UI. In other words, you are working directly at the HTML level, NOT at the Profound widget level.

It is very unusual for a customer to do this, and I find it extremely strange that you would do that. I strongly suspect that you are asking the wrong question! Rather than changing the actual code while the display is running, it'd make much more sense to use stuff like if statements, etc, so that you run different code under different circumstances.
livio.daneluzzi
New User
Posts: 6
Joined: Fri Feb 02, 2018 10:13 am
First Name: Livio
Last Name: Daneluzzi
Company Name: Daneluzzi IT
State / Province: Outside Canada/USA
Country: Italy
Contact:

Re: Onkeyup Javascript from RPG

Post by livio.daneluzzi »

Thanks a lot Scott, for the answer.
I think that to change dinamically the Javascript while display running extends the possibility of manage it without limits.
It's only an idea and I think to try it... if all will works like I think, surely I can share the idea here in the forum. I don't know if, in the future, it will have an application somewhere.
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests