Solved

Email Regular Expression Validator and Required

Posted on 2008-06-20
1
629 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:BobCSD
1 Comment
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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.…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now