mboehler3 9 Posted August 16, 2011 Report 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? Quote Link to post Share on other sites
justsomeguy 1,135 Posted August 16, 2011 Report Share Posted August 16, 2011 The response.write happens always. You probably want that inside an else or something. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.