May 21, 2009 at 7:53 AM

Can you enhance it for DropDownList / select options?


May 22, 2009 at 9:01 AM

Sure, the trick to getting it to work with a DropDownList is to set the value of the default option to an empty string like below. I could look at adding an equivalent to the InitialValue property that the ASP.NET RequiredFieldValidator provides for scenarios where you want it to fire and the default value is not an empty string if you think people might need it.

<asp:DropDownList runat="server" validate="form" required="<b>Required Field Missing</b><br/>You must specify your option.">
    <asp:ListItem Text="-- please select --" Value="" />
    <asp:ListItem>Option 1</asp:ListItem>
    <asp:ListItem>Option 2</asp:ListItem>

But thanks for the feedback, I'll look at updating the included example to include DropDownLists and will also provide examples of disabling the validators and of validating against mutiple regex expressions using the custom validator.

May 25, 2009 at 10:23 AM

Thanks !

Another idea:

You can you enhance it to show messages too as recomendations or instructions to fill each field.


<asp:TextBox ID="txtAsunto" runat="server" Width="450px" validate="form" messagecolor="Blue/#0000FF" message="<b>Remind that ..., </b>"></asp:TextBox>

In this case, the color of box can be another like blue...

Regards !