I have a 'select box' widget type that displays a long text field on the screen for selection, and (as is typical) sends a different field back to the RPG program for processing. Following is what the element's properties look like:
id = WHDROPDOWN
widget type = select box
value = WHDSC
choices database file = INJSUMWRK
choices options field = INJWHDESC
choices values field = INJWH
I want to take this 'select box' element's 'choices options field' property and send it to a hidden 'textbox' element on the screen, also for use in the RPG program.
I've tried the following methods and neither have worked. I've entered this code in the Onchange Event:
var lctndesc = getObj("WHDROPDOWN").pui.properties["choices options field"];
applyProperty('LOCDESC', 'value', lctndesc);
applyProperty('LOCDESC', 'field type', 'textbox');
------------------
var lctndesc = this.pui.properties["choice options field"];
applyProperty('LOCDESC', 'value', lctndesc);
applyProperty('LOCDESC', 'field type', 'textbox');
Thank you!
Wendy
Can you retrieve any or all Element properties?
-
- Profound User
- Posts: 37
- Joined: Mon Aug 06, 2018 4:00 pm
- First Name: Wendy
- Last Name: Sauers
- Company Name: Conestoga Wood Specialties
- Phone: 5706589663
- Address 1: 441 West Market St.
- City: Beavertown
- State / Province: Pennsylvania
- Zip / Postal Code: 17812
- Country: United States
- Contact:
-
- 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: Can you retrieve any or all Element properties?
Do you really want to put the name of the field "INJWHDESC" into the text box? (That is what the code you posted seems to be trying to do.) Or are you looking for the contents of the database's INJWHDESC field for the option that the user selected? (The contents are not in a property, but are in the options of the select box.)
-
- 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: Can you retrieve any or all Element properties?
Was thinking about this... you almost certainly want the text that's displayed in the select box.
Assuming you want to do this in the "onchange" event (like one of your examples) you'd code this:
The disadvantage to doing it during "onchange" (sorry, if this is obvious) is that it'lll only run the code if the user changes the element. For example, if the select was already selected, it won't do anything. (Even if the user clicks the same element again, it won't be considered a "change", since it's the same.)
But, maybe that's the only time you need it in your situation?
Or, maybe now that you know how to get the text, you can adapt it as needed.
Assuming you want to do this in the "onchange" event (like one of your examples) you'd code this:
Code: Select all
pui.set("LOCDESC", this.options[this.selectedIndex].text);
But, maybe that's the only time you need it in your situation?
Or, maybe now that you know how to get the text, you can adapt it as needed.
-
- Profound User
- Posts: 37
- Joined: Mon Aug 06, 2018 4:00 pm
- First Name: Wendy
- Last Name: Sauers
- Company Name: Conestoga Wood Specialties
- Phone: 5706589663
- Address 1: 441 West Market St.
- City: Beavertown
- State / Province: Pennsylvania
- Zip / Postal Code: 17812
- Country: United States
- Contact:
Re: Can you retrieve any or all Element properties?
Thank you Scott!
Yes I definitely wanted to put the contents of the database field INJWHDESC in to the textbox element LOCDESC. I just didn't know how to do it. I only need to capture this any time it changes. I have no default for my select box element and the user will be forced to make a selection.
It worked perfectly as per your usual!
Thanks again, Wendy
Yes I definitely wanted to put the contents of the database field INJWHDESC in to the textbox element LOCDESC. I just didn't know how to do it. I only need to capture this any time it changes. I have no default for my select box element and the user will be forced to make a selection.
It worked perfectly as per your usual!
Thanks again, Wendy
Who is online
Users browsing this forum: No registered users and 1 guest