Email Regular Expression Validator and Required
Posted on 2008-06-20
In my form, the email address is requried and it must pass validation. I have setup a regular expression validator, but I also need to make it a required field. You can tab through it without filling out anything. How do I make it not only check for valid email, but enforce that they insert one? Do I also need a required field validator as well? Or can this be done within the expression below?
Dim valExpression As String = "^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
valEmail.ErrorMessage = "Please enter a valid Email address."
valEmail.ControlToValidate = "txtEmail"
valEmail.ValidationExpression = valExpression