Hi all! I have a form and I want to validate before submit with [1] plugin because nice and good. I want to send the form's data with ajaxForm [2] plugin. The problem is the next: I set the ajaxForm options that before send the data validate. The validate plugin is working fine because I got error message(s) but the empty form was sended always.
I want that while the form is not correct the ajaxForm don't send the data. Does know anybody example for this with these two plugins? Plugins: [1] - http://bassistance.de/jquery-plugins/jquery-plugin-validation/ [2] - http://malsup.com/jquery/form/#getting-started Here is my simple code: <html> <head> <title>asd</title> <script src="jquery.js"></script> <script src="jquery.validate.js"></script> <script src="jquery.form.js"></script> <script> $(document).ready(function() { function formValidate() { $("#formid").validate({ rules:{ asdasd: "required", bsdbsd: "required" }, messages:{ asdasd: "Ide kellene valamit írni!", bsdbsd: "Ide se ártana balyétom!" } }); } var ajaxFormOptions = { beforeSubmit: formValidate() } $("#formid").submit(function(){ $(this).ajaxSubmit(ajaxFormOptions); return false; }); }); </script> </head> <body> <form id="formid" action="post.php" method="post" enctype="multipart/form-data"> <p> asdasd <input id="asdasd" name="asdasd" type="text"> </p> <p> bsdbsd <input id="bsdbsd" name="bsdbsd" type="text"> </p> <p> <input type="submit" value="submit"> </p> </form> </body> </html> I would like appreciate your kind help! -- - - -- Csanyi Andras -- http://sayusi.hu -- Sayusi Ando -- "Bízzál Istenben és tartsd szárazon a puskaport!".-- Cromwell