determine if a form object exists

J

JT

is there a way to determine if a form object actually exists?

if i use the following syntax:

varTextField = Request.Form("txtFormField")

then varTextField = "" which gives the same result whether the input field
"txtFormField" doesn't exist or it does exist but it was left empty

why can't i use something like?

if Exists(Request.Form("txtFormField")) = true then
'whatever..
 
A

Aaron [SQL Server MVP]

Function formFieldExists(fieldName)
formFieldExists = (InStr(Request.Form, fieldname & "=") > 0)
End Function
Response.Write(formFieldExists("txtFormField"))

Now, this will work as long as someone doesn't pass "txtFormField=" in the
DATA for a form field with a different name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top