error console says document.forms[0].submit not a function

Discussion in 'Javascript' started by pantagruel, May 21, 2007.

  1. pantagruel

    pantagruel Guest

    As per the subject line,
    Firefox's error console says document.forms[0].submit is not a
    function.
    the javascript is

    function makequery(param){
    document.forms[0].qu.value=param;
    document.forms[0].submit();
    }

    called by clicking on a link with a javascript url.

    the value of qu gets changed correctly.


    this same thing happens if I use the name of the form, which is main.

    document.main.submit() is not a function.
    pantagruel, May 21, 2007
    #1
    1. Advertising

  2. pantagruel

    Lee Guest

    pantagruel said:
    >
    >As per the subject line,
    >Firefox's error console says document.forms[0].submit is not a
    >function.
    >the javascript is
    >
    >function makequery(param){
    >document.forms[0].qu.value=param;
    >document.forms[0].submit();
    >}


    The error is in your HTML.
    You've named something "submit", haven't you?
    If you name a control "submit", then document.forms[0].submit
    refers to that control, not the function.
    Change the name.


    --
    Lee, May 21, 2007
    #2
    1. Advertising

  3. pantagruel

    pantagruel Guest

    On May 21, 5:01 pm, Lee <> wrote:
    > pantagruel said:
    >
    >
    >
    > >As per the subject line,
    > >Firefox's error console says document.forms[0].submit is not a
    > >function.
    > >the javascript is

    >
    > >function makequery(param){
    > >document.forms[0].qu.value=param;
    > >document.forms[0].submit();
    > >}

    >
    > The error is in your HTML.
    > You've named something "submit", haven't you?
    > If you name a control "submit", then document.forms[0].submit
    > refers to that control, not the function.
    > Change the name.
    >
    > --



    hmm thanks, I think that's right. The page I'm working on is generated
    from somewhere else and I'm adding to it via a proxy but I think the
    button doing the submitting is named submit.
    pantagruel, May 22, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. The Crow
    Replies:
    2
    Views:
    4,372
    Bruce Barker
    Sep 27, 2005
  2. Replies:
    4
    Views:
    902
  3. Harry
    Replies:
    3
    Views:
    361
    Harry
    Jan 12, 2006
  4. Paul M
    Replies:
    1
    Views:
    126
    Lasse Reichstein Nielsen
    Oct 15, 2003
  5. awebguynow
    Replies:
    3
    Views:
    204
    Thomas 'PointedEars' Lahn
    Dec 30, 2005
Loading...

Share This Page