471,316 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,316 software developers and data experts.

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_field1" size="40"
value="some_value1">
<input type="hidden" name="hidden_field2" size="40"
value="some_value2">
</form>
<!--The following Javascript line doesn't work, but why ?-->
<script language="JavaScript">window.document.form1.submit ();</script>

Thanks... :-)
Jul 23 '05 #1
2 16138
Alex wrote:
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_field1" size="40"
value="some_value1">
<input type="hidden" name="hidden_field2" size="40"
value="some_value2">
</form>
<!--The following Javascript line doesn't work, but why ?-->
<script language="JavaScript">window.document.form1.submit ();</script>
Thanks... :-)


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>
..........
..........

Jul 23 '05 #2
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.htm?value1=value&value2=value"
will make the values accessible like posted with method="get" and you
can avoid javascript at all (which is always desirable - imho)

micha

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by lsarg | last post: by
5 posts views Thread by Werner Partner | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.