Skip to content Skip to sidebar Skip to footer

Form Validation In Javascript Does Not Work Probably

I am working on this form which is suppose to validate the form before submitting $(document).ready(function() { $('#form3').validate(); if ($('#form3').valid()) $('#form3'

Solution 1:

Put your code on the form submit event. Something like this:

$(document).ready(function()
{
    $("#form3").validate();
    $("#form3").submit(function(event)    
    {
        if (!$(this).valid()) 
        {
            event.preventDefault();
        }
    });
});

Solution 2:

I think by default after successful validation it will submit the form . However i don't know why you need to resubmit the form.

If you need to submit manually you can use the SubmitHandler place to submit your form.

$("#form3").validate({
   submitHandler: function(form) {       
     form.submit();
   }
});

Solution 3:

I solved the problem and now it works ... It is a minor error !

I changed the submit button name and id to ( Submit).

Post a Comment for "Form Validation In Javascript Does Not Work Probably"