I think I solved my own problem. The callback function does need to be
within the ajaxSubmit function but I wasn't doing it correctly. This
works as intended:

                submitHandler: function(form) {
                        jQuery(form).ajaxSubmit(function() {
                        $.blockUI({ message: '<h1>Creating Account...<br /><br /
><img src="../images/ajax-loader.gif" /></h1>' });

                        setTimeout($.unblockUI, 4000);
                        });
                }

Can you suggest a good JS book for someone who is very familiar with
coding but not JS? I haven't had time to come up to speed on the
language but I am looking to learn fast... A website tutorial would
also help me out.

Thanks

On Mar 17, 8:45 pm, MonkeyBall2010 <hughes.timo...@gmail.com> wrote:
> This is what I have so far:
>
>         $("#submitForm").validate({
>                 rules: {
>                         address: {
>                                 required: true,
>                                 email: true,
>                                 remote: "script/validateEmail.php"
>                         },
>                         password: {
>                                 required: true,
>                                 rangelength: [6, 12]
>                         },
>                         date: {
>                                 required: true,
>                                 date: true
>                         },
>                         zipcode: {
>                                 required: true,
>                                 digits: true,
>                                 rangelength: [5, 5],
>                                 remote: "script/validateZip.php"
>                         },
>                         asfield: {
>                                 required: true,
>                                 rangelength: [3, 3],
>                                 remote: "script/validateASF.php"
>                         }
>                 },
>                 messages: {
>                         address: {
>                                 required: "",
>                                 email: true,
>                                 remote: "  Not Available"
>                         },
>                         password: {
>                                 required: "",
>                                 rangelength: ""
>                         },
>                         date: {
>                                 required: "",
>                                 date: ""
>                         },
>                         zipcode: {
>                                 required: "",
>                                 digits: "",
>                                 rangelength: "",
>                                 remote: "  Zipcode Invalid"
>                         },
>                         asfield: {
>                                 required: "  moo?",
>                                 rangelength: "",
>                                 remote: "  moo?"
>                         }
>                 },
>                 submitHandler: function(form) {
>                         jQuery(form).ajaxSubmit();
>                 }
>
>         });
>
> The form is verified correctly and the AJAX submit works correctly. I
> tried putting the callback function within the jQuery(form).ajaxSubmit
> () function but things weren't working correctly... The after submit
> code works correctly but I just don't know where to put it. Forgive me
> if this is an easy question but I haven't had time to get a book to
> properly come up to speed on JS yet. This is what I am looking to run:
>
> $("#submitForm").ajaxForm(function() {
>         $.blockUI({ message: '<h1>Creating Account...<br /><br /><img
> src="../images/ajax-loader.gif" /></h1>' });
>
>         setTimeout($.unblockUI, 4000);
>
> });
>
> This code is currently outside of the validation code and does not
> work as intended. The script will fired when the user just presses the
> submit button and no validation has taken place.
>
> Thanks

Reply via email to