Click to See Complete Forum and Search --> : Names of Form Elements
Nicodemas
01-10-2003, 05:41 PM
Is there a way to get just the name of the form element in ASP?
Like say, if "changeinfo.asp" submits a form to "dochange.asp" is there a way to get just the names of the form elements that were submitted to "dochange.asp" ?
Nicodemas
01-11-2003, 05:18 AM
Ok, cool ! :D
Now lets take that a step further and ask, can we do this with a conditional statement.
Like... For Each fld in Request.Form (that isn't NULL)
\\do this\\
Next
Nicodemas
01-13-2003, 03:06 AM
Ahhh.. I see. I didn't know that. Geez, Dave.. hasn't your head exploded with all this information? :)
Well, see, my issue is that I have this form that passes information to a .asp page for each request.form element that is sent to it! However, in a new and crazy turn for the worse.. I realize that there are two values that are sent to the page as well that aren't on my page.. X and Y values.
If you use the code you gave me above, and tell the loop to response.write the values sent to it.. you get these two mystery values. Since I'm telling my database to input information through this loop.. and I have no columns in the database named X and Y.. I get an error.
ublend
05-14-2007, 12:40 PM
using "for each item in request.form....
request.form(item)...." gets all elements on the form, including the submit button. That could be the source of your mysterious extra data.
Try adding a conditional statement like this to your code
"for each item in request.form
If request.form(item)<>"Submit" then....
end if
next"
In this case the label (value) of the submit button is tested for, excluding that item from the execution of the code.