Get selected items from multi-select listbox with Javascript
Hi All,
I have a multi-select listbox in a pop-up window that is populated with items from Active Directory.
On the CloseWindow event I want to load all the selected items into a textbox on the parent form.
It's working fine with the code below. But the problem is it is extremely slow because the listbox contains over 10,000 items and I am iterating over each item to determine if it is selected or not.
Is there a way to get the selected items without having to iterate through every item like I am doing here?
to make fast the solution would keep track of selected value in global variable. when a user selects item in that, while changing data will be stored
and
when you need its there in a variable, you attach event to run javascript onselect or onchange event
Can you post an example of how to get the selected values using the innerhtml and Regexp?
Thanks.
ksedran
ASKER
Hey Maverick_Cool,
Can you post an example of how to get the selected values using the innerhtml and Regexp?
Here is some text from the innerhtml property:
<OPTION value=\"ASL Gas Brokers\" selected>ASL Gas Brokers</OPTION>
<OPTION value=BillingContact selected>BillingContact</OPTION>
<OPTION value=TechnicalContact selected>TechnicalContact</OPTION>
<OPTION value=\"Change Management\" selected>Change Management</OPTION>
and
when you need its there in a variable, you attach event to run javascript onselect or onchange event