Re: RegularExpressionValidator?
From: Craig Deelsnyder (cdeelsny_at_NO_SPAM_4_MEyahoo.com)
Date: 02/09/04
- Next message: .NET Follower: "Re: FormsAuthentication - Weird Behaviour"
- Previous message: Yama: "RE: VERY IMPORTANT: Sharing"
- In reply to: DC: "RegularExpressionValidator?"
- Next in thread: Earl Teigrob: "Re: RegularExpressionValidator?"
- Reply: Earl Teigrob: "Re: RegularExpressionValidator?"
- Reply: Scott M.: "Re: RegularExpressionValidator?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 08 Feb 2004 21:05:32 -0600
DC wrote:
> I have this snippet:
>
> <tr>
> <td align="left">E-mail</td>
> <td>
> <asp:TextBox id="txtEmail" runat="server"
> MaxLength="100"></asp:TextBox>
> <asp:RegularExpressionValidator id="revEmail" runat="server"
> ErrorMessage="Enter a valid e-mail address"
> ControlToValidate="txtEmail"
>
> ValidationExpression="\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z0-9._%-]{2,4}\b">
> </asp:RegularExpressionValidator>
> </td>
> </tr>
>
> My question is why this regular expression is not invoked if I leave the
> textbox blank?
> My understanding is blank entry is not met the requirement of that regular
> expression.
>
> Am I missing something here?
>
> - DC
>
>
Validators normally aren't enabled when something is left blank. Why
that decision was made (especially for regex validators) I'll never
know. Slap a RequiredFieldValidator on the field as well and all shall
function properly (if not with a little extra maintenance on your part).
-- Craig Deelsnyder Microsoft MVP - ASP/ASP.NET
- Next message: .NET Follower: "Re: FormsAuthentication - Weird Behaviour"
- Previous message: Yama: "RE: VERY IMPORTANT: Sharing"
- In reply to: DC: "RegularExpressionValidator?"
- Next in thread: Earl Teigrob: "Re: RegularExpressionValidator?"
- Reply: Earl Teigrob: "Re: RegularExpressionValidator?"
- Reply: Scott M.: "Re: RegularExpressionValidator?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|