mboehler3 Posted August 16, 2011 Share Posted August 16, 2011 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 More sharing options...
justsomeguy Posted August 16, 2011 Share Posted August 16, 2011 The response.write happens always. You probably want that inside an else or something. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.