1

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).

sada
  • 584
  • 2
  • 8
  • 25
  • By looking at the above link's source i observed that he had written individual Validate function's for each "step's" Manually – Vivekh Aug 16 '14 at 14:54
  • Thank you for answering. Yes, you are right but I use unobtrusive validation on my other pages so I'd like to use it on this Smart Wizard form page, too. – sada Aug 16 '14 at 14:59

1 Answers1

0

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;
});
Dipu Raj
  • 1,784
  • 4
  • 29
  • 37