R – Client Side Validation for different control events

asp.netclient-sidecustomvalidatorvalidationsummary

I have a custom validator attached to a textbox control as follows

<td align="center" width="10px">
  <asp:CustomValidator ID="validateDateText" ControlToValidate="dateTextBox" 
       runat="server" OnServerValidate="ValidateDate" 
       ClientValidationFunction="Validate_Date" EnableClientScript="true" 
       Width="10px" CssClass="errortext" Text="*" Font-Size="Medium" Font-Bold="true" />
</td>
<td align="center" width="80px">
  <asp:Textbox ID="dateTextBox" MaxLength="100" runat="server"  
       CssClass="dateselectortextbox" style="margin-right: 3px;" />
</td>

When I click a button on the page with causesvalidation="true" the client script fires and the validation summary reflects the error message and the validator shows the *

However when I click out of the textbox only the * is displayed by the validator the validationsummary is not updated

The client side validation is working as the serverside code does not get called im just trying to work out why the validationsummary does not get updated on the onblur event

Any ideas?

EDIT:

The ErrorMessage is set in the codebehind for the validator

I have added the EnableClientScript to my validationsummary

I have added ValidationGroup to my validationsummary, customvalidator, textbox and button, but still the validation summary updates for the button click but not the textbox onblur event

Best Answer

You definitely need to use the errormessage="xyz" for the message to show in the validation summary. The validation group shouldn't matter unless you have more than one group of controls you're validating.

Here is a link to another post that may help you with getting the validation summary to update after the onblur.