Regular Expression Validator question

C

curious

I am using a RegularExpressionValidator to validate a TextBox. I use
"^[\+|-]?[0-9]+(\.[0-9]*)?$" to check for a real number. The control works
fine as long as the user enters something in the TextBox; it does not work if
the user leaves the TextBox blank. Is there a bug in the implementation of
the RegularExpressionValidator? My regluar expression should also catch no
entry by the user.

Thanks.
 
M

marss

curious said:
I am using a RegularExpressionValidator to validate a TextBox. I use
"^[\+|-]?[0-9]+(\.[0-9]*)?$" to check for a real number. The control works
fine as long as the user enters something in the TextBox; it does not work if
the user leaves the TextBox blank. Is there a bug in the implementation of
the RegularExpressionValidator? My regluar expression should also catch no
entry by the user.

Thanks.

MSDN: "Validation succeeds if the input control is empty. If a value is
required for the associated input control, use a RequiredFieldValidator
control in addition to the RegularExpressionValidator control."
 

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
474,263
Messages
2,571,062
Members
48,769
Latest member
Clifft

Latest Threads

Top