I would like to use the precallback function to check the inputs of the form

heres my preCall function


    function preContact()
    {
        // check name is not empty
        if($("input#yrName").value == '')    {
            $("div#contactFrmResult").html("You must include your name in the submission");
            return false;       
        }

        // validate email
        if(isEmailValid($("input#yrEmail").value) == false)    {
            $("div#contactFrmResult").html("You must provide a valid email with your submission");
            return false;       
        }

        // check message is not empty                 
        if($("input#yrName").value == '')    {
            $("div#contactFrmResult").html("You must type a message to send as your submission");
            return false;       
        }

    } //   preContact()

and applying it to the form
           
            $("form#contactFrm").submit(function() {
                // function(target, post_cb, pre_cb, url, mth)
                $(this).ajaxSubmit('div#contactFrmResult', postContact, preContact, 'ajax/contact_sub.php', 'post');
                return false;
            });


however when I leave the name (yrName) blank the form is submited not via ajax.  How do I abort the sumission of the form to return the message tp the contactFrmResult div?

Is there an example of the correct implentation of preCallback with the forms plugin??

thx - Sam
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to