onselect

Use this board to ask questions or have discussions with other Rich Displays users.
oumouna
Profound User
Posts: 37
Joined: Tue Aug 27, 2013 7:34 am
First Name: Seynabou
Last Name: Gueye
Company Name: Oo2
Country: Senegal
Contact:

onselect

Post by oumouna »

I have a list box and a text box. I would like for each value selected in the list box, load it into the text box the number corresponding to that value.
I think that I must do this using Javascript with the property onselect of the list box but I have problem with Javascript. I would like a little help please.
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: onselect

Post by Scott Klement »

I don't think there is an onselect property for a list box, is there?

Can you clarify?
Paul_Ramcharitar
Profound User
Posts: 91
Joined: Fri Aug 03, 2012 11:07 am
First Name: Paul
Last Name: Ramcharitar
Company Name: Banks DIH
City: Georgetown
Zip / Postal Code: 592
Country: Guyana
Contact:

Re: onselect

Post by Paul_Ramcharitar »

There is no onselect property for a listbox, but you could use its onclick property.

Put this in the onclick of your list box:

Code: Select all

pui.set("TextBox1", pui.get(this))
"TextBox1" is the ID of your text box. So you are setting the value of "TextBox1" to the value gotten from your list box when an item is clicked/selected, "pui.get(this)".

I think the "pui.set()" and "pui.get()" functions are available from version 4.6.5
Last edited by Paul_Ramcharitar on Mon Oct 21, 2013 11:17 am, edited 1 time in total.
oumouna
Profound User
Posts: 37
Joined: Tue Aug 27, 2013 7:34 am
First Name: Seynabou
Last Name: Gueye
Company Name: Oo2
Country: Senegal
Contact:

Re: onselect

Post by oumouna »

Scott
I do a mistake, It is a dropdown box, not a list box.
I read this part of the documentation:
"onselect event (Combo Box)
The onselect event for combo boxes activates when a selection is made from the combo choices. The event should be specified as a JavaScript expression."
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: onselect

Post by Scott Klement »

Actually, a "list box" and a "drop down box" are the same thing, except that the list box shows more than one row at a time on the screen. They are the same widget, under the covers.

However, a combo box is different. A combo box allows the user to type their selection as well as selecting it from the choices. When they do select one, the 'onselect' event will fire. Is that what you are using, a Combo box?

Can you also explain more about what is meant by "I would like for each value selected in the list box, load it into the text box the number corresponding to that value."
oumouna
Profound User
Posts: 37
Joined: Tue Aug 27, 2013 7:34 am
First Name: Seynabou
Last Name: Gueye
Company Name: Oo2
Country: Senegal
Contact:

Re: onselect

Post by oumouna »

I thaught that Dropdown box and Combo box are the same.
I have a list of differents pieces (CNI, PA, PC) and for each piece I have a number.
For example for my CNI the number is xxxxxxxxxxxxxxxxxx and for my Passport the number is xxxxxxxxxxxxxxxxxx.
I want that when I choose one of the piece, to load the number matching with that type of piece in the text box.
The datas are in a table of a database.
Last edited by oumouna on Mon Oct 21, 2013 11:53 am, edited 1 time in total.
oumouna
Profound User
Posts: 37
Joined: Tue Aug 27, 2013 7:34 am
First Name: Seynabou
Last Name: Gueye
Company Name: Oo2
Country: Senegal
Contact:

Re: onselect

Post by oumouna »

I am using Combo Box
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: onselect

Post by Scott Klement »

I would set the "onchange" value of the combo box to pui.click(). When the user makes a change, this will cause control to be returned to the RPG program. The RPG program can then set all of the fields on the screen to the corresponding values.

If you'd like an indicator to be set (to notify the RPG program that the onchange fired) you can put a hidden button on the screen, and do pui.click("id of hidden button"). The response of the button can be bound to an indicator that the RPG program can check for.
oumouna
Profound User
Posts: 37
Joined: Tue Aug 27, 2013 7:34 am
First Name: Seynabou
Last Name: Gueye
Company Name: Oo2
Country: Senegal
Contact:

Re: onselect

Post by oumouna »

When I do [onchange] pui.click("ID of hidden Button"), when a value is select in the combo box, does this put the button on??
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: onselect

Post by Scott Klement »

It clicks the button (just as it would if someone clicked it with the mouse.) This way, the button can turn an indicator on and return control to your RPG program, and the RPG program can check for the button being clicked.

IF you make it a hidden button, then the button can only be clicked via pui.click().
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests