title: Defining when onclick is fired
body: <p>I am having a little issue with something.  I have a form, and I map the fields of the form within a system.  The button of the form is automatically given an onclick event like this</p>
  
  <pre><code>window.location='http://www.something.com/test.html?vs=ZWJhMDAzMzktMTNkYi00ODRkLTgxYmQtNjQwYTU5MDIyZWE3OzA6ODc5NjY2NzoxMjg2NzUyNDM3NDI6OTAxNzM0MzA1OjkwMTczNDMwNTsS1'
  </code></pre>
  
  <p>It adds a vs variable which is needed.  The problem is I need the form to have an input type button, not submit.  I am using JQuery validation and I have this to trigger the form submission</p>
  
  <pre><code>$("#btn-default2").click(function() {
          $("#myform").submit();
      });
  </code></pre>
  
  <p>Now the issue with this, because of the onclick event, the validation quickly fires and then the onclick event does a redirect.  I only want this redirect if the form is valid.  Is there any way to stop the event onclick, and move it into my function where I check if the form is valid?</p>
  
  <p>Thanks</p>