Click to See Complete Forum and Search --> : automatic form submit


DonT55
12-31-2002, 12:45 PM
I am using the following code to automatically bypass a page yet pass a form parameter to the following page that is looking for the parameter:

<form name="frmDC" method="post" action="default.asp?cal=CR">
<input type="hidden" name="txtCR" value="dcr">
<script language="JavaScript">document.frmDC.submit();</script></form>

This script works well in Netscape 4.7 and IE but does not automatically trigger the submit action in Netscape 7. Any ideas on how to automatically activate the submit button in Netscape 7?

Thank you in advance for your assistance

DonT55

spoontacular
12-31-2002, 12:52 PM
Try:
document.forms["frmDC"].submit();

Charles
12-31-2002, 01:00 PM
But what about the one in ten users that do not use JavaScript? Use instead:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh" content="0;url=default.asp?cal=CR&txtCR=dcr">
<title>Redirect</title>
<p><a href="default.asp?cal=CR&txtCR=dcr">Continue</a></p>

Though, of you have access to ASP then you ought to be able to do this with a simple HTTP redirect header.

spoontacular
12-31-2002, 01:04 PM
The one in ten users should enable JavaScript or update to a browser that supports it. :D

DonT55
12-31-2002, 01:19 PM
OK -- I have it under control now -- the code you sent did not work on it's own Spoontacular but by creating a function called DoIt() and activating it through <body onload="JavaScript:DoIt()"> -- the script now works in all browsers we use and automatically moves on to the next page with the request.form parameter set, which is exactly what I need -- thanks for all your help.

And yes, any browser someone is using today that does not use JavaScript should be outlawed!!!

DonT55

Charles
12-31-2002, 01:51 PM
Originally posted by spoontacular
The one in ten users should enable JavaScript or update to a browser that supports it. :D

Originally posted by DonT55
And yes, any browser someone is using today that does not use JavaScript should be outlawed!!! Quite to the contrary. In quite a few places, including Canada, the UK and the US, it's making a page that relies upon JavaScript that has been outlawed. (For the US Department of Justice opinion on the matter see http://www.usdoj.gov/crt/foia/tal712.txt.) Persons with certain disabilities cannot use browsers with JavaScript. And then there are persons, like myself, who cannot stand the horrible things that bad web authors do with JavaScript. It's not a matter of upgrading our browsers. Think about it. JavaScript enabled Internet Explorer has far more than 90% of the market, I believe. Yet only 90% of users use JavaScript. Users are disabling JavaScript to defend themselves from you.

spoontacular
12-31-2002, 02:29 PM
Very true. Browsers that people with disabilites use do support JavaScript, but not completely. Maybe window.open() is disabled unless requested, etc.