Here is my JavaScript:
jQuery.validator.addMethod("ChznCheck", function(val, elem) {
return $(elem).val();
}, "Required before continuing");
jQuery.validator.setDefaults({
errorElement: 'span',
onkeyup: false,
onclick: false,
onfocusout: false,
onsubmit: false,
focusCleanup: true,
ignore: [],
rules: {
"user[username]": {
required: true,
remote: {
url: '/check_username',
type: 'post',
data: {
username: function() {
return $('#user_username').val();
}
}
}
},
"user[state]": {
ChznCheck: true
}
},
messages: {
"user[username]": "Username unavailable, please try again"
}
});
$(function(){
var $form, wizard;
wizard = $('#registrationWizard').wizard();
$form = $('#finalize-form');
if ($form.length) {
wizard.on('change', function(e, data) {
log($form.validate().form());
if (!$form.validate().form()) {
return e.preventDefault();
}
}).on('finished', function(e) {
return $form.submit();
});
}
})
I am using the fuel UX wizard (http://exacttarget.github.io/fuelux/#wizard) and I am using the Chosen library (http://harvesthq.github.io/chosen/) to "prettify" my select boxes. For some reason, when I get done filling out all fields in Step 1, and click Next, the form still fails, even though everything is filled out properly.
I am basically just trying to use the jQuery validation plugin (http://jqueryvalidation.org/) along with chosen to be able to validate my form, but am having no success. Anyone else run into this issue?