Jump to content

ASP Form Validation not working


Recommended Posts

Hi, I'm trying to add ASP validation to the form on this page here.Here's the code that I created:

<%If Request("POSTBACK") = "YES" Then	oops = ""		name = Trim(Request("name"))	Set nmre = New RegExp	nmre.Pattern = "^[a-zA-Z\'\-]{3,99}$"	If name = "Your Name" OR Not nmre.Test( Replace(name," ","") ) Then		oops = oops & "<li>Please enter your name</li>"	End If	Set emre = New RegExp	emre.Pattern = "^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$"	emre.IgnoreCase = True	If Not emre.Test( Request("email") ) Then		oops = oops & "<li>Please enter a valid email address</li>"	End If		If oops = "" Then		Server.Transfer "/ask-michael/#thankyou"	End If	Response.Write "Please correct the following errors and submit the form again:<ul>" & oops & "</ul>"End If%><form method="post" name="askmichael" onSubmit="return checkrefervalues();"><input name="POSTBACK" type="hidden" value="YES">

When I hit submit on the form (with all valid fields), I get this error: "Please correct the following errors and submit the form again:," with nothing listed. Am I close to getting this validation to work?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...