I have a problem with something. I have a form, and I display the form fields inside the system. The form button automatically receives an onclick event like this
window.location='http://www.something.com/test.html?vs=ZWJhMDAzMzktMTNkYi00ODRkLTgxYmQtNjQwYTU5MDIyZWE3OzA6ODc5NjY2NzoxMjg2NzUyNDM3NDI6OTAxNzM0MzA1OjkwMTczNDMwNTsS1'
It adds the vs variable, which is needed. The problem is that I need a form in order to have a button like input rather than submit. I am using jQuery validation and I have this to force the form to submit
$("#btn-default2").click(function() { $("#myform").submit(); });
Now the problem with this, due to the onclick event, the check fires quickly, and then the onclick event performs a redirect. I just want this redirect if the form is valid. Is there a way to stop the onclick event and transfer it to my function, where I check if the form is valid?
thanks
source share