.NETGURU
Is there a RegExp to require a value?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngregexp' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Marcie Jones (VIP)
Hi List,
I'm very new to Regular Expressions, so please excuse
me if I'm missing something very basic.

I'm using a RegExp validator control around an email
address textbox (works great), and I'm wondering if
there's a way to also specify in the RegExp that this
field is required. I'm just trying to avoid using
both a RegExp validator and a required field validator
on the same control--is this possible?

Thanks for any input!
Marcie

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

Reply to this message...
 
    
Wayne King
The validator controls are designed to be used together. That is, the =
solution *is* to use a RegularExpressionValidator and a =
RequiredFieldValidator that are both validating the same textbox. If =
the textbox is empty, the RegularExpressionValidator isn't even =
activated. So, regardless of the ValidationExpression, there is no way =
to cause the RegExValidator to fail on empty input.

-----Original Message-----
From: Marcie Jones [mailto:Click here to reveal e-mail address]
Sent: Tuesday, October 16, 2001 6:59 AM
To: aspngregexp
Subject: [aspngregexp] Is there a RegExp to require a value?

Hi List,
I'm very new to Regular Expressions, so please excuse
me if I'm missing something very basic.

I'm using a RegExp validator control around an email
address textbox (works great), and I'm wondering if
there's a way to also specify in the RegExp that this
field is required. I'm just trying to avoid using
both a RegExp validator and a required field validator
on the same control--is this possible?

Thanks for any input!
Marcie

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

| [aspngregexp] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngregexp.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
    
Steven A Smith (VIP)
Yes, Wayne is correct. If you want to cut down on the number of controls
you need to put on the page, you might take a look at some free controls
I've been working on at http://aspsmith.com/vcontrols/" target="_blank">http://aspsmith.com/vcontrols/, including a control
called EmailBox that includes the textbox, the requiredfieldvalidator, and
the regexvalidator all in one control (and does mx record checking on top of
all that if you want it to).

Also, when you're looking for regex examples, or the ultimate email
validator, check out http://regexlib.com which has a bunch of expressions
(and add your own if they're not there).

Steve

Steven Smith
President, ASPAlliance.com
http://aspalliance.com The #1 ASP.NET Community
http://aspsmith.com ASP.NET Training for ASP Developers
Click here to reveal e-mail address
----- Original Message -----
From: "Wayne King" <Click here to reveal e-mail address>
To: "aspngregexp" <Click here to reveal e-mail address>
Sent: Tuesday, October 16, 2001 5:02 PM
Subject: [aspngregexp] RE: Is there a RegExp to require a value?

The validator controls are designed to be used together. That is, the
solution *is* to use a RegularExpressionValidator and a
RequiredFieldValidator that are both validating the same textbox. If the
textbox is empty, the RegularExpressionValidator isn't even activated. So,
regardless of the ValidationExpression, there is no way to cause the
RegExValidator to fail on empty input.

-----Original Message-----
From: Marcie Jones [mailto:Click here to reveal e-mail address]
Sent: Tuesday, October 16, 2001 6:59 AM
To: aspngregexp
Subject: [aspngregexp] Is there a RegExp to require a value?

Hi List,
I'm very new to Regular Expressions, so please excuse
me if I'm missing something very basic.

I'm using a RegExp validator control around an email
address textbox (works great), and I'm wondering if
there's a way to also specify in the RegExp that this
field is required. I'm just trying to avoid using
both a RegExp validator and a required field validator
on the same control--is this possible?

Thanks for any input!
Marcie

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

| [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

| [aspngregexp] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngregexp.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
 
System.Web.UI.WebControls.RegularExpressionValidator
System.Web.UI.WebControls.RequiredFieldValidator




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification