Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Regular expression validator-Not rejecting nulls


Message #1 by sg48@y... on Sun, 29 Sep 2002 21:55:02
A NULL  / empty value is considered valid for almost all validation 
controls, including the RegularExpressionValidator control.

To prevent people from leaving the field empty, add a 
RequiredFieldValidator as well, and have it point (ControlToValidate) to 
txtEmail as well.

HtH

Imar


At 09:55 PM 9/29/2002 +0000, you wrote:
>I have a simple regularexpressionvalidator control
>that works fine if an obviously wrong e-mail address is typed in.
>However if the user doesn't enter anything,- i.e., leaves the input text
>box with null entered, the regularexpressionvalidator doesn't reject
>the input. Any thoughts?  TIA- Steve
>
>
><asp:regularexpressionvalidator
>ControlToValidate="txtEmail"
>Text="Invalid Email Address!"
>ValidationExpression="\w+\w*\@\...+\w+\w*\.(com|edu|org|gov|biz)"
>foreColor="#ffffff"
>runat="Server"/>
>---



  Return to Index