Hi!
I'm using the jQuery validation plugin. I have my form on the master page, i set up my validation rules in one of my aspx pages like this:
$("#aspnetForm").validate({
errorLabelContainer: $("ul", $('div.error-container')),
wrapper: 'li',
onkeyup: false,
rules: {
ctl00$Content$dbTurnOverDate$txtDate: {
dateISO: true,
required: true,
},
ctl00$Content$nbAmount$txtNumber: {
required: true,
number: true
},
ctl00$Content$dbPeriodicityStart$txtDate: {
dateISO: true
},
ctl00$Content$dbPeriodicityStop$txtDate: {
dateISO: true
},
ctl00$Content$ccTurnoverCategory$txtCategory: {
required: true
}
}, messages:
{
ctl00$Content$dbTurnOverDate$txtDate:{required: 'Date is required', dateISO: 'Date must be ISO'},
ctl00$Content$nbAmount$txtNumber:{required: 'Amount is required', number: 'Amount must be a valid number'},
ctl00$Content$dbPeriodicityStart$txtDate:{dateISO: 'Date must be ISO'},
ctl00$Content$dbPeriodicityStop$txtDate:{dateISO: 'Date must be ISO'},
ctl00$Content$ccTurnoverCategory$txtCategory:{required: 'Category is required'}
},
errorClass: "validationError", validClass: "validationValid",
});
This all works fine on page load, the errors appears nicely in my error container defined like this at the top of the page:
<div class="error-container">
<ul>
</ul>
</div>
The problems start after i do a post back on my page (some controls has server events connected to them), then the post back is complete no errors renders in my errorLabelContainer but my validationError-class still works (red frame around inputs).
I tried to put my validation code in document.ready and in the pageLoad function, no success.