I can't disable form's validation. I have tried many solution from other questions and forums like:
1. $("#PatientForm").validate({ ignore: "*" });
2. $("#submitButton").addClass("cancel");
3. $('#PatientForm').validate().settings.ignore = ["*"];
4. $("#PatientForm").validate({ onsubmit: false });
5. $('#PatientForm').validate({ submitHandler: null });
And jQuery Validate still wants to validate all the fields. I am trying to diable on checkbox change. Checkbox change handler is throttled because I've check it with FireBug and all the calls (1. to 5.) executes without any error messages.
Here is my configuration of validation:
// JQUERY VALIDATE - TURN ON VALIDATION ON SUBMIT + VALIDATE PESEL BEFORE SAVE
$('#PatientForm').validate({
submitHandler: function(form) {
var pesel = $('#Pesel').val();
var isValid = $(form).valid();
$.ajax({
type: 'GET',
url: '@Url.Action("IsPeselExisting", "Admin")',
data: { peselPar: pesel },
success: function (msg) {
if (msg["exists"] == 'true')
{
if (isValid == true)
{
if (confirm("Wprowadzony pesel już istnieje! Czy na pewno chcesz dodać użytkownika o kolidującym peselu"))
{
form.submit();
}
}
}
else
{
if (isValid == true)
{
form.submit();
}
}
}
});
}
});
// JQUERY VALIDATE - GENERAL SETTINGS
$('#PatientForm').validate().settings.ignore = [];
$("#PatientForm").validate({ ignore: ".ignored" });
// JQUERY VALIDATE - GENERAL SETTINGS
$.validator.addMethod("regex", function (value, element, regexp) {
return regexp.test(value);
}, "");
Thanks in advance...
jQuery('#form').validate().currentForm = '';Enabling the form again:jQuery('#form').validate().currentForm = jQuery('#form')[0];Why jQuery Validation is so unpredictable? :(