RegularExpression validator that does not allow blanks

J

John Hoge

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
 
C

Chris Moore

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/default.asp?url=/library/en-us/cpgenref/ht
ml/cpconregularexpressionvalidatorcontrol.asp

HTH,
Chris [MSFT]

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top