Solved

Email Regular Expression Validator and Required

Posted on 2008-06-20
1
639 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
ororiole earned 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

634 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