471,123 Members | 860 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,123 software developers and data experts.

RegularExpression validator that does not allow blanks

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
2 2623
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
Thanks,

John
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Niki Kovacs | last post: by
2 posts views Thread by Stephan Bour | last post: by
9 posts views Thread by Alex Shirley | last post: by
1 post views Thread by Nicola Farina | last post: by
3 posts views Thread by Arpan | last post: by
37 posts views Thread by Prisoner at War | last post: by

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.