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:
<input type="hidden" id="hidden0" name="Options2" value="0" />
<input type="hidden" id="hidden1" name="Options2" value="30" />
<input type="hidden" id="hidden2" name="Options2" value="4" />
<input type="hidden" id="hidden3" name="Options2" value="-1" />
<input type="hidden" id="hidden4" name="Options2" value="-1" />
<input type="hidden" id="hidden5" name="Options2" value="-1" />
<input type="hidden" id="hidden6" name="Options2" value="-1" />
<input type="hidden" id="hidden7" name="Options2" value="-1" />
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.
var inputs = document.getElementsByName("Options"+cpt);
for( var g = 0; g < 8; g++ )
{
document.all.Options[g].value = inputs[g].value;
}
When I receive the form, I got this line:
var arrayOption = Request.Form("Options");
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:
for (var k = 0; k < arrayOption.count; k++) {
Response.Write(arrayOption[k]);
}
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?
Well that looks like ASP Classic + Server side JScript so you need an Enumerator()
to walk the collection, E.g.
for (var e = new Enumerator(Request.Form); !e.atEnd(); e.moveNext())
Response.Write(e.item() + "=" + Request.Form(e.item()) + "<br>");
Enumerates all the post data