Forums
This topic is locked
Submit form without button
Posted 22 Sep 2002 23:42:05
1
has voted
22 Sep 2002 23:42:05 Leon Downes posted:
Hi,I am trying to submit a form with out having to use a button. I have used the code below to try get the page to submit the form on page load but it does not appear to work in my situation
<body onLoad="document.FormName.Submit();">
I have a link which I click to go to a detail page based upon a unique ID. The detail page loads and has a defined value in a HIDDEN FIELD. I have then used an update server behavior to replace the existing value in the database with the one stored in the hidden field. If I use a submit button the application works as I want it to, however I want to be able to have the value input into that database automatically upon page load.
If any one can help it would be very much appreciated. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Best Regards,
Leon
Replies
Replied 24 Sep 2002 10:41:11
24 Sep 2002 10:41:11 Gary Whittle replied:
I do this quite often.
Simply replace your submit button HTML with the following:
<script>
document.form1.submit()
</script>
Change "form1" to the name of your form.
Gary.
Simply replace your submit button HTML with the following:
<script>
document.form1.submit()
</script>
Change "form1" to the name of your form.
Gary.
Replied 24 Sep 2002 10:43:33
24 Sep 2002 10:43:33 Gary Whittle replied:
Oh and one more thing.
I think the reason body onLoad does not work, is because your form has not yet been written.
You probably get an "object expected" error or "document.form is null or not an object".
If HTML runs top to bottom, then this would make sense.
I am by no means an expert, just I have had to do this task a few times now.
Gary.
I think the reason body onLoad does not work, is because your form has not yet been written.
You probably get an "object expected" error or "document.form is null or not an object".
If HTML runs top to bottom, then this would make sense.
I am by no means an expert, just I have had to do this task a few times now.
Gary.
Replied 24 Sep 2002 18:17:00
24 Sep 2002 18:17:00 Leon Downes replied:
Thank you Gary my form now submits without a button <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>