Chris
Chris

Reputation: 129

JQuery Tools - Validator - Validate without submit button

I hope somebody can help.

I have been using JQuery Tools to validate my forms without issue but now need to process a form programmatically.

The following 2 lines validate the form however I am not sure how to return a success/fail value once the check has happened.

var check = $("#new_form :input").validator();
check.data("validator").checkValidity();

Essentially I am thinking (rightly or wrongly?) along these lines:-

var check = $("#new_form :input").validator();
check.data("validator").checkValidity();
if (check==true) {........

.....}

Hopefully the above makes sense. I have studied the Validator Usage page and tried to crack it by myself but no joy.

Help and suggestions greatly appreciated.

Thanks

Chris

Upvotes: 2

Views: 1730

Answers (1)

Chris
Chris

Reputation: 129

This solved it in the end

if (check.data("validator").checkValidity()==true){...}

Upvotes: 1

Related Questions