Jquery validation, step by step validate on click function.
Posted
by Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2010-03-17T12:09:29Z
Indexed on
2010/03/17
12:11 UTC
Read the original article
Hit count: 249
Trying to get jquery validation plugin work with my step by step form and here is the function i made. It works but only with first step. Any other step or final submit wont work in that case. If anyone could have a look whats wrong with my code i would appreciate the most.
Thank you.
function StepByStep(){
var a = {
rules: {
fieldname1: "required",
fieldname2: "required",
}
}
var b = {
rules: {
fieldname3:"required"
}
}
var aStep = $("form").validate(a);
var bStep = $("form").validate(b);
$('input.nextStep').click(function(){
if (aStep.form()) {
//open step 2 function
}
return false
});
$('input.submit').click(function(){
if (bStep.form()) {
$('form').submit();
}
return false
}); }
© Stack Overflow or respective owner