I have a textbox where by a time of day is entered. I would like to validate that a valid time (such as 08:00am) has been entered. At the same time, I do not want to require any input at all.User can leave the box blank if they want.I have an Ajax Extender to help the user enter a valid time if they so choose.
Also, I would like to only warn the user of entering an invalid time when (and only when) the submit button is clicked. It seems the problem with setting EnableClientScript=true is that if the user clicks inside the text box and and then clicks out the client side validator fires right away. I do not want this.
Further complicating this is it seems that currently simply leaving EnableClientScript=false and Enabled=true(server side validator) doesn't seem to be working at all. It just lets the input through. How do I get this to work in the manner I have just described. Any advice would be greatly appreciated. .aspx markup is below.
<asp:TextBox ID="tbCompTime" runat="server" ValidationGroup="grpMainDriver" MaxLength="10" />
<ajx:MaskedEditExtender ID="meecomptime" runat="server" AcceptAMPM="true" TargetControlID="tbCompTime" Mask="99:99" MaskType="Time" MessageValidatorTip="true"> </ajx:MaskedEditExtender>
<ajx:MaskedEditValidator ID="mevcomptime" EnableClientScript="false" Enabled="true" ValidationGroup="valComplaintGroup" runat="server" ControlToValidate="tbCompTime" ControlExtender="meecomptime" IsValidEmpty="True" InvalidValueMessage="Time not valid" > </ajx:MaskedEditValidator>
<asp:Button runat="server" CausesValidation="true" ValidationGroup="valComplaintGroup" id="btnSubmitComplaint" OnClick="btnSubmitComplaint_click" Text ="Submit Complaint"/>