Click to See Complete Forum and Search --> : form JS assistance needed


Razorwyre
12-16-2002, 12:10 PM
I'll list the HTML and the JS I'm using and see if anyone can give me a hint on how to do the thing correctly.

HTML -->

<form method="post" name="form">
...
<input type="hidden" name="orderList[0]" value="Bob">
<input type="hidden" name="orderList[1]" value="Mary">
<input type="hidden" name="orderList[2]" value="Jane">
...
<input type="button" value="submit" onClick="doList()">
</form>


JavaScript -->

function doOrder() {
for (i=0; i <= 3; i++) {
form.orderList[i].value = list.options[i].text;
}
document.form.submit();
}


So, what happens is I have another JS routine that allows the user to re-order the items. When they hit Submit button, it runs the doOrder() function before submitting the form. I know the problem is in the "form.orderList[i]" in the middle of the function, but I don't know how you use JS to populate an array like that. Any ideas?

Razorwyre
12-17-2002, 09:38 AM
That's dead-on what I was looking for. Thanks!
:D