Javascript array with Request.Form

diegreen

New Member
I got a question that is probably stupid, but I'm not able to make it work...I'm submitting a form which contains inputs like this:\[code\]<input type="hidden" id="hidden0" name="Options2" value="http://stackoverflow.com/questions/12284047/0" /><input type="hidden" id="hidden1" name="Options2" value="http://stackoverflow.com/questions/12284047/30" /><input type="hidden" id="hidden2" name="Options2" value="http://stackoverflow.com/questions/12284047/4" /><input type="hidden" id="hidden3" name="Options2" value="http://stackoverflow.com/questions/12284047/-1" /><input type="hidden" id="hidden4" name="Options2" value="http://stackoverflow.com/questions/12284047/-1" /><input type="hidden" id="hidden5" name="Options2" value="http://stackoverflow.com/questions/12284047/-1" /><input type="hidden" id="hidden6" name="Options2" value="http://stackoverflow.com/questions/12284047/-1" /><input type="hidden" id="hidden7" name="Options2" value="http://stackoverflow.com/questions/12284047/-1" />\[/code\]Note that these 8 inputs are created dynamically. When submit is clicked, I get all the inputs created dynamically with the name="Options" and put the values into some general inputs.\[code\]var inputs = document.getElementsByName("Options"+cpt);for( var g = 0; g < 8; g++ ){ document.all.Options[g].value = http://stackoverflow.com/questions/12284047/inputs[g].value;}\[/code\]When I receive the form, I got this line:\[code\]var arrayOption = Request.Form("Options");\[/code\]If I Response.Write(arrayOption), I can see the result: 0, 30, 4, -1, etc...I'm trying to get all values inside a loop like this:\[code\]for (var k = 0; k < arrayOption.count; k++) { Response.Write(arrayOption[k]);}\[/code\]In this case, arrayOption[k] is undefined and I don't know why. I also noticed that arrayOption.length is not working (this is why I used .count). It looks like arrayOption is not a true array, so I tried to split, but Object doesn't support this property or method. What's wrong with all this?
 
Back
Top