livevalidation icon indicating copy to clipboard operation
livevalidation copied to clipboard

Button action wont validate

Open ambasador opened this issue 12 years ago • 1 comments

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" });

ambasador avatar Aug 22 '13 08:08 ambasador

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.

BrianPMucha avatar Apr 29 '14 20:04 BrianPMucha