Solved

Email Regular Expression Validator and Required

Posted on 2008-06-20
1
635 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
daypilot scheduler 3 37
Add a Condition in ASP Repeater 6 34
ASP Repeater control - onl;y show if flag is true 7 16
Why use this lambda? 12 39
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…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 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