Open ambasador opened 11 years ago
Hi all,
I've a problem with valid element age on click. I want to check first that element age is valid then load loadresults();, i've tried few option but they dont work, anyone knows how to fix it
$('button').click(function () { loadresults(); }); var age = new LiveValidation('age', { validMessage: "Message ", wait: 1000 }); age.add(Validate.Numericality, { minimum: 18, maximum: 100, onlyInteger: true, notANumberMessage: "Only Numbers" }); age.add(Validate.Presence, { failureMessage: "Error" });
I think instead of binding to .click on the button you need to use .submit on the form. LV will stop the submit if validation fails.
Hi all,
I've a problem with valid element age on click. I want to check first that element age is valid then load loadresults();, i've tried few option but they dont work, anyone knows how to fix it
$('button').click(function () { loadresults(); }); var age = new LiveValidation('age', { validMessage: "Message ", wait: 1000 }); age.add(Validate.Numericality, { minimum: 18, maximum: 100, onlyInteger: true, notANumberMessage: "Only Numbers" }); age.add(Validate.Presence, { failureMessage: "Error" });