combining jquery validate and ajaxForm plugins

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

combining jquery validate and ajaxForm plugins

tempest4000
I had both the validation and the ajaxform working fine alone, but when I try to combine the form doesn't work properly.  I am not that familiar with JQuery and so think the syntax is wrong somewhere.  Can anyone spot what Im doing wrong?

The form takes two attempts before it validates, and then the form sends but does not give any response.

// prepare the form when the DOM is ready
$(document).ready(function() {
    var options = {
        target:        '#output1',   // target element(s) to be updated with server response
        beforeSubmit:  showRequest,  // pre-submit callback
        success:       showResponse  // post-submit callback
    };
 
    // bind form using 'ajaxForm'
    $('form#webcheck').ajaxForm(options);
});
 
    function showRequest(){
                $("form#webcheck").validate();
                jQuery.validator.messages.required = jQuery.validator.messages.email = "";
                jQuery.validator.messages.required = jQuery.validator.messages.telephone = "";
                jQuery.validator.messages.required = jQuery.validator.messages.name = "";
        }
       
        function showResponse(){
        alert('Thanks for your comment!');
        }