Click to See Complete Forum and Search --> : Accessing form input box name


fark
12-11-2003, 06:53 PM
I know that in javascript
This refers to the value in the input field
document.frm1.elements[i].value
This refers to the name of the input field
document.frm1.elements[i].name

In ASP
This refers to the value in the input field
Request.Form(2)
How do I access the name of the input field?

I've tried
Request.Form(2).Name
and a bunch of other things but haven't figured it out yet. Any ideas? Thanks

lcscne
12-12-2003, 08:10 AM
Request.Form(2) is accessing the field by its ID. To access it by name do Request.Form("fieldName").

fark
12-12-2003, 10:47 AM
What if I want to access the fieldName? What if I don't necessarily know the name that was given to the input box? Can I access it somehow?? I want to go through each ID and print the name that was given to each input box in my form on the previous page. I don't want to access the value of the input box I want to access the name of it. Thanks, for you help.

fark
12-12-2003, 11:46 AM
This appears to do the trick
Response.Write Request.Form.key(2)

I searched MSDN for an hour or two and couldn't find this anywhere. Anyone know where this would be located in that massive library?? Thanks.