Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

jquery form submit / validate

Options
  • 08-05-2009 11:50am
    #1
    Registered Users Posts: 8,070 ✭✭✭


    using
    http://bassistance.de/jquery-plugins/jquery-plugin-validation/


    [PHP]
    <script type="text/javascript">
    jQuery.validator.setDefaults({
    debug: true,
    success: "valid"
    });;



    $(document).ready(function(){
    $("#form").validate({
    rules: {
    email:{required: true,email: true},
    phone:{required: true,digits: true},
    fname:{required: true}
    },

    submitHandler: function() {
    $("#form").submit();
    }

    });
    });

    </script>
    then


    <form name="form" id="form" method="POST" action="comp.php">

    ETC
    ETC

    submit button
    [/PHP]

    basically if i sub $("#form").submit(); with ALERT, it alerts me , so not sure how i can submit form after validation ?

    thanks


Comments

  • Registered Users Posts: 6,511 ✭✭✭daymobrew


    The docs mention recursion - I think that your $("#form").submit(); is causing this.
    Try changing your submitHandler to:
    [php] submitHandler: function(form) {
    form.submit();
    }[/php]


  • Registered Users Posts: 8,070 ✭✭✭Placebo


    thanks day
    i got it working, by just removing the submit function completely.


Advertisement