BrightNail
11-29-2002, 08:58 AM
is there a clever way to reiterate thru a forms select drop downs (generic names that change)..so I would need to reiterate thru these select boxes in order as they appear on the page..
anyways, is there a way to grab each select drop downs values and corresponding text and put them in their own array for each select box..for example..onpage load...having the value/text would be seperated by a ":"
<select name="random name">
<option value="iujyt56trd">someting 1</option>
<option value="sudvb56t">someting 2</option>
</select>
<select name="random name 2">
<option value="iuj66trd">another 1</option>
<option value="a444444">another 2</option>
</select>
the onLoad would create -->
genericArray1 =new Array ("iujyt56trd:someting1", "sudvb56t:something2");
genericArray2 =new Array ("iuj66trd:another 1","a444444:another 2");
and basically, onLoad, the function would cycle thru the selects and each select would have its own array of its value/text pairs..
the reason for this is because the contents of the dropdowns are dynamically created...so when the page loads, I want to 'store' them because there is a reset button...so when they click "reset"..I just run thru the arrays for the appropriate select box and repopulate it...
any ideas?.....actually, my only problem is actually "creating a unique array for each select box and populating it with value/text pairs seperated by a ":"
thansk,
james
anyways, is there a way to grab each select drop downs values and corresponding text and put them in their own array for each select box..for example..onpage load...having the value/text would be seperated by a ":"
<select name="random name">
<option value="iujyt56trd">someting 1</option>
<option value="sudvb56t">someting 2</option>
</select>
<select name="random name 2">
<option value="iuj66trd">another 1</option>
<option value="a444444">another 2</option>
</select>
the onLoad would create -->
genericArray1 =new Array ("iujyt56trd:someting1", "sudvb56t:something2");
genericArray2 =new Array ("iuj66trd:another 1","a444444:another 2");
and basically, onLoad, the function would cycle thru the selects and each select would have its own array of its value/text pairs..
the reason for this is because the contents of the dropdowns are dynamically created...so when the page loads, I want to 'store' them because there is a reset button...so when they click "reset"..I just run thru the arrays for the appropriate select box and repopulate it...
any ideas?.....actually, my only problem is actually "creating a unique array for each select box and populating it with value/text pairs seperated by a ":"
thansk,
james