Problem on FIREFOX with "document.form.submit();"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex

    Problem on FIREFOX with "document.form.submit();"

    Hello,

    I use the following script inside a page. My page contains : 1 FORM,
    Some Hidden fields, and one line of JAVASCRIPT in order to instantly
    post the Form.
    The problem is that under FIREFOX, the JAVASCRIPT line don't seems to
    be correct, because FIREFOX does'nt post the Form... But my javascript
    line looks correct to me...

    Below is the Script; thanks for your Help in advance.
    Alex.

    <form action="my_next _page.html" method="POST" name="form1">
    <input type="hidden" name="hidden_fi eld1" size="40"
    value="some_val ue1">
    <input type="hidden" name="hidden_fi eld2" size="40"
    value="some_val ue2">
    </form>
    <!--The following Javascript line doesn't work, but why ?-->
    <script language="JavaS cript">window.d ocument.form1.s ubmit();</script>

    Thanks... :-)
  • RobB

    #2
    Re: Problem on FIREFOX with &quot;document. form.submit();& quot;

    Alex wrote:[color=blue]
    > Hello,
    >
    > I use the following script inside a page. My page contains : 1 FORM,
    > Some Hidden fields, and one line of JAVASCRIPT in order to instantly
    > post the Form.
    > The problem is that under FIREFOX, the JAVASCRIPT line don't seems to
    > be correct, because FIREFOX does'nt post the Form... But my[/color]
    javascript[color=blue]
    > line looks correct to me...
    >
    > Below is the Script; thanks for your Help in advance.
    > Alex.
    >
    > <form action="my_next _page.html" method="POST" name="form1">
    > <input type="hidden" name="hidden_fi eld1" size="40"
    > value="some_val ue1">
    > <input type="hidden" name="hidden_fi eld2" size="40"
    > value="some_val ue2">
    > </form>
    > <!--The following Javascript line doesn't work, but why ?-->
    > <script[/color]
    language="JavaS cript">window.d ocument.form1.s ubmit();</script>[color=blue]
    >
    > Thanks... :-)[/color]

    Who knows, could be the usual timing error. Try onload instead:

    <html>
    <head>
    <script type="text/javascript">

    window.onload = function()
    {
    document.forms[0].submit();
    }

    </script>
    </head>
    <body>
    ..........
    ..........

    Comment

    • micha

      #3
      Re: Problem on FIREFOX with &quot;document. form.submit();& quot;

      as far i can see you just want to pass two values that cannot be
      altered by the user to the next page. why use a form at all?

      some kind of redirect to "my_next_page.h tm?value1=value &value2=valu e"
      will make the values accessible like posted with method="get" and you
      can avoid javascript at all (which is always desirable - imho)

      micha

      Comment

      Working...