Check this example:
http://jquery.bassistance.de/validate/demo/ajaxSubmit-intergration-demo.html
Use ajaxSubmit instead of ajaxForm and put that into the submitHandler.
Jörn
On Tue, Nov 11, 2008 at 9:19 AM, lance123 <[EMAIL PROTECTED]> wrote:
>
> Hi To All,
>
> I am trying to get the jquery ajaxform plugin to work with the
> validate plugin and I cannot seem to get submission right! It will
> not stop the submission process no matter what I do. :(
>
> Here is my test code...any help much appreciated. Thanks Lance
>
> $.validator.setDefaults({
> submitHandler: function() { alert("submitted!"); }
> });
>
> $().ready(function() {
>
> // validate signup form on keyup and submit
> $("#formaaa").validate({
> rules: {
> username: {
> required: true,
> minlength: 2 },
>
> },
> messages: {
> username: {
> required: "Please enter a username",
> minlength: "Your username must consist of at
> least 2 characters"
> },
> }
> });
> });
>
> var FormID;
> $(document).ready(function () {
>
> //Bind the mouseover function to the form element
> $("form").bind("mouseenter mouseleave", function(e){
> FormID=(this.id);
> // bind form using ajaxForm
> $('#'+FormID).ajaxForm({
> // target identifies the element(s) to update with the server
> response
> target: '#htmlExampleTarget'+FormID,
> url: 'html-echo.php',
>
> // success identifies the function to invoke when the server
> response
> // has been received; here we apply a fade-in effect to the
> new content
> success: function() {
> $('#htmlExampleTarget'+FormID).fadeIn('slow');
> }
> });
> });
> });
> </script>
> <style>
> p { background:yellow; font-weight:bold; cursor:pointer;
> padding:5px; }
> p.over { background: #ccc; }
> span { color:red; }
> </style>
>
> </head>
> <body>
>
>
> <form id="formaaa" class="" action="" method="post" onSubmit="return
> false;" >
> Message: <input type="text" name="username" value=""
> id="username" class="required" minlength="10" />
> <input type="submit" value="Echo as HTML" />
> </form>
> <h3>htmlExampleTarget (output will be added below):</h3>
> <div id="htmlExampleTargetformaaa"></div>
>
>
> </body>
> </html>
>