Skip to Content
0
Former Member
May 19, 2005 at 05:00 PM

Retrieving HTMLB DropdownListBox from JavaScript

17 Views

Hi!

Does anyone know the correct JavaScript syntax to retrieve the Key and Value of the selected item from an HTMLB DropdownListBox?

I am doing something like the following, but I am missing the correct syntax for a few items:

var funcName = myFormID + "_getHtmlbElementId";

func = window(funcName);

var selected = eval(func("dropdown_id"));

var inf1 = eval(func("input_filed1"));

var inf2 = eval(func("input_field2"));

if (selected) {

var key = selected.getValue();

inf2.setValue(key);

//I don't know how to get the corresponding text for the selected key

var text = selected.getTextForValue();

inf1.setValue(text);

}

Thank you!