Forum Moderators: open
I have an html form that I would like to autosubmit, so I've used javascript: document.form1.submit();
My problem is that when it returns a result to my page, it automatically submits the info in the form over and over again.
Is there a STOP command, or something else that I can put to stop this happening? I'd be grateful for any help received,
Derek
If you're using php, you should detect when the page is being delivered as a form action and ensure the resulting page does not autosubmit.
If you are using static html you should add a # value to the url when used as the form's action and not autosubmit when a # value is detected.
e.g.
<form action="page.html#done">...</form>
<script>
if (location.hash == '') form.submit();
</script>
Using a # value rather than an url parameter avoids possible duplicate content issues with search engines.
Kaled.