0

I'm using the jQuery Validation JS

I have two contact forms, the main one that appears on one page only, and a quick-contact that is on all pages.

How can I prevent quick-contact form to show the error messages ONLY on submit (without effecting the other form)

1 Answer 1

1

i havent used the jQ validation myself, however when i do my very basic javascript side validation, i reference the form, and check for a submitted value, for example, say we had a form with and id of myform and then your javascript code would look like:

<form id="myform" method="post" action="...">
<!-- fields go here -->
</form>

//reference the form
var myform = $('form#myform');

// Setup your validation functions here

// Run validation only on submit of the form, returning success or failure.
form.submit(function()) {
     if(function_1() & function_2()...) {
          return true;
     else
          return false;
});

That way the validation code only runs when that particular form is submitted.

Hope that helps :)

Sign up to request clarification or add additional context in comments.

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.