snowball
01-06-2003, 04:36 PM
Hi, can anyone help?
I have a cgi script with a little java code in it which produces a page where the only thing on it is a submit button and a whole load of hidden values in the form. The operation works great, but you sit on this page until you press "Submit". I just want (effectively) to have the button press itself without the user having to do anything.
The usual ..............
<script type="text/javascript">
<!--
document.MYFORMNAME.submit();
// -->
</script>
causes the form to submit over and over again. You'll see in the original (below) that the submit button has an ..... onClick="saveForm(this.form);" ..... command in it, which calls on the saveForm function higher up the page.
I've tried moving those commands down, but if I do nothing happens at all. The page just sits there with an error saying "object does not support this property or method".
So I'm stuck on either a page that just sits there (doing nothing with an error) or a form that resubmits endlessly, rather than the submit once and move on to the next page, which is what the page with the submit button achieves now.
Here's the code ....................
<script language="JavaScript1.1">
<!--
function saveForm() {
document.htmlForm.target="_self"
document.htmlForm.submit
}
//-->
</script>
<FORM METHOD=POST ACTION="$cgiurl" name="htmlForm">
$Account::hidden_variables
<script language="JavaScript1.1">
<!--
if ("$INPUT{'template'}" === "template_2.dat") {
document.write('<input type=\"hidden\" name=\"_file_name_\" value=\"gallery.html\">');
} else {
document.write('<input type=\"hidden\" name=\"_file_name_\" value=\"index.html\">');
}
//-->
</script>
<input type="hidden" name="dir" value="">
<input type="Submit" name="save" value = " $lang::ut5 " onClick="saveForm(this.form);">
</FORM>
If anyone has any other ideas I would be really, really greatful.
Thanks
snow
I have a cgi script with a little java code in it which produces a page where the only thing on it is a submit button and a whole load of hidden values in the form. The operation works great, but you sit on this page until you press "Submit". I just want (effectively) to have the button press itself without the user having to do anything.
The usual ..............
<script type="text/javascript">
<!--
document.MYFORMNAME.submit();
// -->
</script>
causes the form to submit over and over again. You'll see in the original (below) that the submit button has an ..... onClick="saveForm(this.form);" ..... command in it, which calls on the saveForm function higher up the page.
I've tried moving those commands down, but if I do nothing happens at all. The page just sits there with an error saying "object does not support this property or method".
So I'm stuck on either a page that just sits there (doing nothing with an error) or a form that resubmits endlessly, rather than the submit once and move on to the next page, which is what the page with the submit button achieves now.
Here's the code ....................
<script language="JavaScript1.1">
<!--
function saveForm() {
document.htmlForm.target="_self"
document.htmlForm.submit
}
//-->
</script>
<FORM METHOD=POST ACTION="$cgiurl" name="htmlForm">
$Account::hidden_variables
<script language="JavaScript1.1">
<!--
if ("$INPUT{'template'}" === "template_2.dat") {
document.write('<input type=\"hidden\" name=\"_file_name_\" value=\"gallery.html\">');
} else {
document.write('<input type=\"hidden\" name=\"_file_name_\" value=\"index.html\">');
}
//-->
</script>
<input type="hidden" name="dir" value="">
<input type="Submit" name="save" value = " $lang::ut5 " onClick="saveForm(this.form);">
</FORM>
If anyone has any other ideas I would be really, really greatful.
Thanks
snow