开发者

jquery Malsup's form plugin and Ketchup validation to work together?

i'm having lots of problems getting the 2 plugins to work together...

heres the script i'm currently using, which doesn't work... it submits the form without validation...

   <script>
function validate() { 
$('#contact_form').ketchup();
}

function showResponse() { 
$('#form_content').html('thanks you for submitting the form');
}


$(document).ready(function() { 

$('#contact_fo开发者_StackOverflow中文版rm').ajaxForm( {
beforeSubmit: validate, 
success:  showResponse
} ); 

}); 
</script>

if i add a 'return false' in the validate function then the ketchup validation is triggered and the form is correctly validated, but even if it passes validation it doesn't submit.

anyone got any suggestions for how to get these 2 scripts to play nice together?

cheers

dog


some one over on experts exchange managed to solve this for me....

here is the final script :

$(document).ready(function() {
    $('#contact_form').ketchup();
    $("input[type='submit']", "#contact_form").click(function(e) {
        if( $('#contact_form').ketchup("isValid") ) { 
            $('#contact_form').ajaxForm(function() { $('#form_content').html('thank you for filling the form'); });
        };
    });
});

this works perfectly :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜