I'm using the FormToWizard Jquery plugin with this Bassistance validation plugin. I have attached my next button to a click event which validates my form however I only want it to validate the current fieldset not the whole form.
What formtowizard does is show one fieldset at a time and generate next and back buttons in each fieldset to browse around the form.
It goes like this:
<form id="SignupForm" method="POST" action="..................">
<fieldset>
<legend>Step One</legend>
<div>
</div>
</fieldset>
<fieldset>
<legend>Step Two</legend>
<div>
</div>
</fieldset>
</form>
And this is how i declared the bassistance validator
$("a.next").click(function() {
$("#formID").validate();
});
And I found this code from this already answered topic about the very same problem but it doesn't seem to work! Validate between fieldsets
He basically added a few lines of code in an existing FormToWizard plugin method.
function createNextButton(i) {
var stepName = "step" + i;
$("#" + stepName + "commands").append("<a href='#' id='" + stepName + "Next' class='next'>Next</a>");
$("#" + stepName + "Next").bind("click", function(e) {
/* VALIDATION */
if (options.validationEnabled) {
var stepIsValid = true;
$("#"+stepName+" :input").each(function(index) {
checkMe = element.validate().element($(this));
//stepIsValid = !element.validate().element($(this)) && stepIsValid;
stepIsValid = checkMe && stepIsValid;
});
//alert("stepIsValid === "+stepIsValid);
if (!stepIsValid) {
return false;
};
};
$("#" + stepName).hide();
$("#step" + (i + 1)).show();
if (i + 2 == count)
$(submmitButtonName).show();
selectStep(i + 1,'next');
});
}
Any idea how to get this work? I am not a jquery/javascript pro since I am just starting, I am still trying to learn how the syntax work and why that person made those changes.