Reputation: 693
I have a long form which is splitted into 3 pieces with the jQuery Smart Wizard. The demo, which I took as a starting point, is here. I would like to use jQuery unobtrusive validation but unfortunately the 'aria-required' attribute is missing from each input element, so '$('#inputField').valid() validation is always true. Does anyone have experience with this, please?
EDIT: There is no need the aria-required attribute for the validation, but the other attributes are present (data-val-required, data-val, aria-invalid).
Upvotes: 1
Views: 1415
Reputation: 1884
It is late but I found the latest example with the input validation Smart Wizard: Demo Input Validation. It uses the jQuery validator plugin for valdation each step, and there you can add your own custom validation.
$("#smartwizard").on("leaveStep", function(e, anchorObject, stepNumber) {
var elmForm = $("#form-step-" + stepNumber);
if(elmForm){
// Add the custom validation here
elmForm.validator('validate');
var elmErr = elmForm.children('.has-error');
if(elmErr && elmErr.length > 0){
// Error found
return false;
}
}
return true;
});
Upvotes: 0