Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Email Regular Expression Validator and Required

Posted on 2008-06-20
1
Medium Priority
?
649 Views
Last Modified: 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

Thanks!
0
Comment
Question by:Starr Duskk
1 Comment
 
LVL 16

Accepted Solution

by:
ororiole earned 2000 total points
ID: 21833502
You need to add a required field validator as well. This is a very common pattern. While you could write a custom validator to do both, its quicker and convenient to use 2 validator controls.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question