how to append error messages on validation summary through javascript. i have added a validation summary, click on check button need to validate the credit card and retrieve the information back to the user, if the card is invalid i need to display that message in the validation summary. how can i do that? is there any way to programatically add the error messages to the validation summary using javascript?
how to append some error messages on xval validation summary through javascript in MVC?
6.5k views Asked by nimi At
1
First of all, you need to express your question better...
As far as I understand, you make AJAX call and if it fails you need to update the validation summary. Solution: use jQuery.
More details: Validation summary is rendered into the element with class "validation-summary-errors" - like this:
So to update it you need to append a new li item to it. Here's how you do using jQuery:
Now, where to call the above code depends on how you check the credit card - jquery, ms ajax, etc.