0

I am using the http://jqueryvalidation.org/ to validate my forms and by default this is called when the form gets submitted. I am wanting to start the validation when the function I have wrapped it into is called.

So basically, I have this for the validation:

function ticketCreateSubmit()
{
   $("#ticketForm").validate({
      ...
   });
}

And then this is getting called by: ticketCreateSubmit(); in my payments page. The form does have the id of ticketForm. The function does get called, but the validation does not take action?

I searched the validation website and I found that if I put onsubmit: false, it doesn't process it on form submit, but that still didn't get the validation to run when the function is being called?

How would I go about this?

Just so everyone understands, I'm only needing to call the VALIDATION so it runs from the external script. I'm not needing to do anything else. Just execute the validation.

2
  • $("#ticketForm").validate() attaches a validator to the form. It's not executing the validation. Commented Feb 2, 2015 at 17:12
  • I've figured that much out....... I'm asking what I can do to execute the validation. I'm not able to find anything on the website. Commented Feb 2, 2015 at 17:15

2 Answers 2

1

Try this

var form = $("#ticketForm")
form.validate({
      ...
});

function ticketCreateSubmit()
{
  form.valid() 
}
Sign up to request clarification or add additional context in comments.

Comments

0

You could try putting onsubmit="ticketCreateSubmit();return false" on the form submit.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.