473,772 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regular Expression / Required Field Validator

I am using the Regular Expression Validator control to validate a
correct email address. But, at the same time I would like to make it a
required field.

I tested by using just the regular expression validator expecting a
message to be displayed but it let me submit the form. Do I have to use
both?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #1
5 4471
Yes. All validators other than required return IsValid = true when they are
blank.

bill

"John ." <jr****@yahoo.c om> wrote in message
news:OA******** *****@TK2MSFTNG P12.phx.gbl...
I am using the Regular Expression Validator control to validate a
correct email address. But, at the same time I would like to make it a
required field.

I tested by using just the regular expression validator expecting a
message to be displayed but it let me submit the form. Do I have to use
both?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #2
With the way the MS validators are set up, you may need both. Regex,
technically, should check for the condition and not allow an empty string. I
am not sure if you place in a condition to check for empty vals how it will
handle it, as I have not tested it.

Personally, I find the validation controls, other than the custom validator,
to be a waste of time on anything other than a very simple form.
---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************

"John ." wrote:
I am using the Regular Expression Validator control to validate a
correct email address. But, at the same time I would like to make it a
required field.

I tested by using just the regular expression validator expecting a
message to be displayed but it let me submit the form. Do I have to use
both?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #3
Yup...you'd think you wouldn't....you can always create your own
RegularExpressi onValidator which simply expands the built-in
regularexpressi onvalidator...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"John ." <jr****@yahoo.c om> wrote in message
news:OA******** *****@TK2MSFTNG P12.phx.gbl...
I am using the Regular Expression Validator control to validate a
correct email address. But, at the same time I would like to make it a
required field.

I tested by using just the regular expression validator expecting a
message to be displayed but it let me submit the form. Do I have to use
both?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #4
You can add a RequiredFieldVa lidator in addition to your RegExValidator to
do the additional validation check.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I am using the Regular Expression Validator control to validate a
correct email address. But, at the same time I would like to make it
a required field.

I tested by using just the regular expression validator expecting a
message to be displayed but it let me submit the form. Do I have to
use both?

*** Sent via Developersdex http://www.developersdex.com *** Don't just
participate in USENET...get rewarded for it!


Nov 19 '05 #5
In case you want a better set of validators, my "Profession al Validation And
More" (http://www.peterblum.com/vam/home.aspx) addresses most of the
complaints users have with the ASP.NET validators. For example, my
RegexValidator has a property IgnoreBlankText . When true, it works like the
ASP.NET Regex validator. When false, it reports an error when the TextBox is
blank. There are literally hundreds of improvements like this that will make
it easy to match your validation requirements to my controls.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"John ." <jr****@yahoo.c om> wrote in message
news:OA******** *****@TK2MSFTNG P12.phx.gbl...
I am using the Regular Expression Validator control to validate a
correct email address. But, at the same time I would like to make it a
required field.

I tested by using just the regular expression validator expecting a
message to be displayed but it let me submit the form. Do I have to use
both?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
528
by: amazononthemoon | last post by:
I have not been able to find any examples of the type of validation I need. I have numeric fields on a web page that I only want them to enter numbers with two decimal places. I would like to allow them to enter a number with comma or with out comma. (for example the could enter 1000.00 or 1,000.00 or 1000) The other field I need help with is a list of user ID separated by comma, ie user123, userabc, user321. They could enter one user...
3
4099
by: Jorell | last post by:
Hi everyone. I have never worked with regular expressions before and here is my dillema: I have a textbox that I want to only accept this type of input: 1,2,3-8,10,16 ( Comma separated numbers or Hyphenated ranges ) I want to use a validator for this, so I assume I use a
2
2947
by: VSK | last post by:
Hi all, I have a .ascx file with dropdownbox (SSN, EmpName) textbox submit button regular expression validator( controltovalidate is the above textbox) Now i want to change the Regular Expression of the validator based on the
2
2255
by: Nazir | last post by:
Hi I'm using a regular expression validator, but if spaces are entered, it bypasses the validation! I'm using ^{5,100}$
2
9873
by: Dot net work | last post by:
Hello. Say I have a .net textbox that uses a .net regularexpressionvalidator. If the regular expression fails, is it possible to launch a small client side javascript function to do something, such as change the border color of the textbox to red? That would look quite nice: if the expression fails, the red validator text is shown, plus the textbox's border goes red. TIA,
2
1396
by: kieran | last post by:
Hi, I am using Visual Studio 2005 and am trying to use a Regular Expression Validator control. I have a drop down list which contains various names, the first one is "Please Select". I want the user to have to select a name other than 'Please Select'. I am thinking maybe the Regular Expression Validator is the best move
3
5364
by: CK | last post by:
Hello All, I have a page with a text box. It has a required field validator, and a regualur expression validator tied to it. A valid email is required. When clientside is enabled it works great. When it's disabled the server side validation works for the required field, but the server side doesn't work for the regEx validator. Any ideas? Is it because two validators are tied to the same control? Thanks,
1
2265
by: vtxr1300 | last post by:
I'm having a problem with a regular expression in conjunction with the regular expression validator. I am trying to make sure that when a user browses for a file to upload, it ends in gif, jpeg or jpg. I have the following expression which validates fine in a .net tester I use and also a javascript tester. But when I use the following path on the page, it gives me the error message that I haven't entered a valid image. ...
6
7985
by: David | last post by:
I'm having trouble getting the regular expression validator to work with a text box. In this simple example I only want lower case letters to be allowed. So I tried the following and it doesn't work, would somebody be so kind as to tell me why. <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.