jQuery: The Write Less, Do More JavaScript Library

Form submit issues

View: New views
3 Messages — Rating Filter:   Alert me  

Form submit issues

by ChrisR-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


What is wrong with this code?

<code>$(document).ready(function() {
        $("#f_submit").hide();
        $("#f_altsubmit").click(function(event) {
                $("#checkoutform")[0].submit();
                return false;
        });
});</code>

In FF3 this throws an error in the Error console : Error: $("form")
[0].submit is not a function
but this error does not show up in Firebug.

Also what is strange is that when i change the method from submit() to
reset() ... the reset works ...
It seems my form doesn't have the submit method in FF3????

See for yourself at http://dev.rotarygiftshop.com/cart/checkout

Re: Form submit issues

by malsup :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


> What is wrong with this code?
>
> <code>$(document).ready(function() {
>         $("#f_submit").hide();
>         $("#f_altsubmit").click(function(event) {
>                 $("#checkoutform")[0].submit();
>                 return false;
>         });
>
> });</code>
>
> In FF3 this throws an error in the Error console : Error: $("form")
> [0].submit is not a function
> but this error does not show up in Firebug.
>
> Also what is strange is that when i change the method from submit() to
> reset() ... the reset works ...
> It seems my form doesn't have the submit method in FF3????
>
> See for yourself athttp://dev.rotarygiftshop.com/cart/checkout


You have an input named 'submit'.  Change the name/id of that input
and you'll be fine.

Re: Form submit issues

by ChrisR-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks alot, can't believe i haven't tried changing that form item ...

feels stupig but happy it's resolved :)

Chris

On 5 jul, 01:40, Mike Alsup <mal...@...> wrote:

> > What is wrong with this code?
>
> > <code>$(document).ready(function() {
> >         $("#f_submit").hide();
> >         $("#f_altsubmit").click(function(event) {
> >                 $("#checkoutform")[0].submit();
> >                 return false;
> >         });
>
> > });</code>
>
> > In FF3 this throws an error in the Error console : Error: $("form")
> > [0].submitis not a function
> > but this error does not show up in Firebug.
>
> > Also what is strange is that when i change the method fromsubmit() to
> > reset() ... the reset works ...
> > It seems myformdoesn't have thesubmitmethod in FF3????
>
> > See for yourself athttp://dev.rotarygiftshop.com/cart/checkout
>
> You have an input named 'submit'.  Change the name/id of that input
> and you'll be fine.