By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,423 Members | 1,601 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,423 IT Pros & Developers. It's quick & easy.

RegularExpression validator that does not allow blanks

P: n/a
I have a regex "^\d{5}$" that does not allow blanks, but the
RegularExpressionValidator does not fire for empty fields. Is there a
way to make it do so? I would rather not include a separate
RequiredValidator for reasons of brevity and neatness.

Thanks,
John
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi John,

Unfortunately, you will need both a RequiredFieldValidator AND a
RegularExpressionValidator for your purposes.

Here's the word from the MSDN Library:
"Note: If the input control is empty, no validation functions are called
and validation succeeds. Use a RequiredFieldValidator control to prevent
the user from skipping an input control."

You can find the full article here:
http://msdn.microsoft.com/library/de...us/cpgenref/ht
ml/cpconregularexpressionvalidatorcontrol.asp

HTH,
Chris [MSFT]

--------------------
From: jh******@yahoo.com (John Hoge)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: RegularExpression validator that does not allow blanks
Date: 21 May 2004 14:26:36 -0700
Organization: http://groups.google.com
Lines: 7
Message-ID: <d0**************************@posting.google.com >
NNTP-Posting-Host: 151.202.10.13
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1085174796 26003 127.0.0.1 (21 May 2004 21:26:36 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Fri, 21 May 2004 21:26:36 +0000 (UTC)
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!news.glorb.com!postnews1.google.com!not-for-mailXref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet:235531
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

I have a regex "^\d{5}$" that does not allow blanks, but the
RegularExpressionValidator does not fire for empty fields. Is there a
way to make it do so? I would rather not include a separate
RequiredValidator for reasons of brevity and neatness.

Thanks,
John


Nov 18 '05 #2

P: n/a
Thanks,

John
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.