Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie ASP Question

Status
Not open for further replies.

jpadie

Technical User
Nov 24, 2003
10,094
0
0
FR
Hi all
i'm pottering with ASP having been more or less exclusive to PHP recently. I feel like I'm cheating on my partner. Kind of sordid.

how do i test to make sure that a particular form field has actually been submitted in ASP? i'm currently trying to stop a bot from hijacking a form without using captcha (by testing for a hidden field that a bot would normally fill). problem is that this bot has the old shape of the form and my code is only testing to see whether the form control has any text within it.

so, again, how do I check for actual submission? would it be testing for null?

thanks
Justin
 
Suppose the form has this:
[tt]<input type="text" name="Foo">[/tt]


In the page that "processes" the form, something like this:
[tt]If Request.Form("Foo") <> "" Then
Response.Write "Some value was submitted!"
End If[/tt]
 
Hmm, I think I'm going to have point this post out from the PHP forum next time I am over there ;)

 
You can test to see if a form field was submitted by doing a

Code:
Request.Form("fieldName").count

If nothing was submitted, this will return 0.
Note that if you have multiple fields with the same name, count can be greater than 1, as
Request.Form("multipleUsedName")
will be an array.

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top