Retrieving current selection value from a drop down box

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Retrieving current selection value from a drop down box

Post by Stuart »

Hello, I need to retrieve the selected value from a dropdown box, via Javascript.
I am coding the "onchange" event for the dropdown widget.

I have tried:

get("selectBox"),
var combo = document.getElementById("selectBox");
var strUser = combo[combo.selectedIndex].text;

None of these work.

Thanks for the help!
rmullis
Experienced User
Posts: 100
Joined: Tue Feb 21, 2012 1:24 pm
First Name: Robert
Last Name: Mullis
Company Name: WRC
State / Province: Georgia
Country: United States
Contact:

Re: Retrieving current selection value from a drop down box

Post by rmullis »

Try this:

var selectText = getObj("SelectBoxID");
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Re: Retrieving current selection value from a drop down box

Post by Stuart »

Thanks for the tip!

I need to elaborate on the problem more:

The dropdown box is attached to a table (subfile)

There are 2 options, and one of those options needs to run a pc Command
The iSeries (RPG) program runs a host command to create a PDF file
The pdf file then needs to be passed as a parameter to the pc Command.
Since the pdf is being generated thru a host command, based on user selection,
and then a PC command needs to run to process the file, how can I achieve all this
with the onchange event of the drop down box? By the way, the pdf file name is variable, so I need to pass control to the RPG program to create the file, and then run a javascript (runPCCommand) that will process the command string that is created in the RPG program.

Can all this be done with one button click? I am beginning to think that I may need 2 events, one to create the PDF, and the other event to send the file.

(I decided to post this as a seperate topic)
Stuart
Profound User
Posts: 30
Joined: Tue Apr 17, 2012 4:37 pm
First Name: Stuart
Last Name: Leonard
Company Name: Summit Holdings
Phone: 813-665-6060
Address 1: 2310 Commerce Point Drive
City: Lakeland
State / Province: Florida
Zip / Postal Code: 33594
Country: United States
Contact:

Re: Retrieving current selection value from a drop down box

Post by Stuart »

var selected = getObj("selectBox");
alert(selected);
if (selected == "DISPLAY") pui.click("Event");
if (selected == "SEND TO IR") processCommands(get("Command"));

when using the getObj command, passing the id of the dropdown box, the popup
displays "null" (this is coded on an "onchange" event)
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests