Client side validation for various management events

I have a custom validator attached to a textbox control like this

<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 valididation = "true" reasons, the client script is run, and the validation summary reflects the error message, and the validator shows *

However, when I exit the textbox, only the validator displays *, the validation is not updated

Client side validation works as the server code is not called im, but just trying to figure out why validationsummary is not being updated in the onblur event.

Any ideas?

EDIT:

ErrorMessage is set in the code to check the validator

I added EnableClientScript to my validationsummary file

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

+2


source to share


3 answers


You should definitely use errormessage = "xyz" for the message to be displayed in the verification summary. The review group shouldn't matter if you have multiple control items that you are reviewing.



There is a link to another post here that might help you get a summary of the validation to update after onblur.

+3


source


You need to set dateTextBox.ValidationGroup

, validateDateText.ValidationGroup

and yourValidationSummary.ValidationGroup

to the same value.



See http://msmvps.com/blogs/brianmadsen/pages/ASP.Net-2.0-_2D00_-How-to-use-the-new-validation-features_2C00_-part-1.aspx .

0


source


I think you can use ErrorMessage = "Some informative error message" inside your CustomValidator. You also need to set ValidationGroup = "SomeGroupName" for CustomValidator, ValidationSummary, and the control that triggers the postback.

0


source







All Articles