Hector
Hector

Reputation: 682

Submit Handler not working

The code I am using below is validating correctly but not submitting when fields are valid:

<script>
  $(document).ready(function(){
    $("#verifyformDesktop").validate({
   errorContainer: "#messageBox1, #messageBox2",
   errorLabelContainer: "#messageBox1 ul",
   wrapper: "li", debug:true,
   submitHandler: function(form) {
     form.submit();
   }
 })
});
</script>

<form name="verifyformDesktop" id="verifyformDesktop" action="php/verify.php" method="post">
...
<input type="submit" name="submit" id="submit" value="ENTER">

Maybe the submitHandler?

Upvotes: 0

Views: 6693

Answers (1)

Sparky
Sparky

Reputation: 98728

Remove debug: true, from your .validate() options.

It's only used for testing and blocks the submit.

debug: Enables debug mode. If true, the form is not submitted...

http://docs.jquery.com/Plugins/Validation/validate#toptions

Working Demo:

http://jsfiddle.net/FHAV2/

You also do not need to declare a submitHandler: function...

submitHandler: function(form) {
    form.submit();
}

... because that's simply the default plugin behavior when you leave it out.

However, if you need to do other things, then it is correct...

submitHandler: function(form) {
    // do some other stuff before submit
    form.submit();
}

Upvotes: 1

Related Questions