[thelist] RE: asp.net: Why won't InitialValue work

Casey Crookston casey at thecrookstons.com
Wed Dec 22 21:44:58 CST 2004

> ASP RegularExpressionValidator control will validate on the client if it
> an 'uplevel' browser - IE 5.5+, all other browsers will post back for
> validation on the server.

Thanks, but this doesn't help me solve the problem at all.  I would like to
offer the user an example of how the date format should be, and make it a
required field, and validate the format.  My question is, how come when I
use InitialValue in the RequiredFieldValidator does it no longer make it a
required field?  The original post is below.



> If I include InitialValue="MM-DD-YYYY" in the
> RegularExpressionValidator,
> nothing happens... it's like it's not even there.  If I include it in
> the
> RequiredFieldValidator, it also does not display the initial value, AND
> the
> validator stops working and allows an empty value.  What's with that?
> How
> can I make this work?
> <form runat="server">
> <asp:textbox id="joined" runat="server" />
> <asp:RegularExpressionValidator id="revJoined"
> ControlToValidate="joined"
> ErrorMessage="Formt: Enter Date: MM-DD-YYYY"  Display="Dynamic"
> ValidationExpression="\d{2}-\d{2}-\d{4}" runat="server" />
> <asp:RequiredFieldValidator id="rfvJoined" ControlToValidate="joined"
> ErrorMessage="Required: Enter Date: MM-DD-YYYY" Display="Dynamic"
> runat="server" />
> </form>

More information about the thelist mailing list