Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit Form automatically onLoad 2

Status
Not open for further replies.

esearing

IS-IT--Management
Joined
Aug 22, 2000
Messages
132
Location
US
I have a script which creates a new HTML page which contains form data that will be passed to a cgi program.

1) the user selects form1 items on page 1 and hits Submit
2) which writes code to page two (contains code and form1.values with action to call cgi program). Currently the user must hit submit a second time to run the program.

Is there a way to submit form2 when the 2nd page loads so the user never sees it.

i.e onLoad=Submit(Form2)

Many thanks in advance
Eric

If you create something idiot proof,
Nature will create a better idiot.
 
<body onLoad=&quot;document.formName.submit();&quot;>
 
Excellent service Link9!
Eric

If you create something idiot proof,
Nature will create a better idiot.
 
Dear link9

Below are the steps I use to implement your suggestion.
You can see that I use Matt Wright's famous formmail.cgi
which insists on sending the user to a redirect page.

This code is in the index.html of the site.
The real stuff is in the redirected main.html

The question are:

1. Will this interfere with search engine spiders, causing the real stuff never to be seen?

2. Do you know of any form2email program that doesn't insist on a &quot;thank-you&quot; page, so that the process can be put on the main page?

Thank you for your excellent suggestion.

Helmut

Snippets of code:

var visitorname = GetCookie('visitorname');
var visitoremail = GetCookie('visitoremail');

function InitializeForm() {
document.notify.realname.value = visitorname;
document.notify.email.value = visitoremail;
document.notify.submit();
}

<body onload=&quot;InitializeForm();&quot;>

<form name=&quot;notify&quot; action=&quot; method=&quot;POST&quot;>
<input type=hidden name=&quot;recipient&quot; value=&quot;engcomp@ozemail.com.au&quot;>
<input type=hidden name=&quot;subject&quot; value=&quot;notify main&quot;>
<input type=hidden name=&quot;redirect&quot; value=&quot; <input type=hidden name=&quot;email&quot; value=&quot;noEmail&quot;>
<input type=hidden name=&quot;realname&quot; value=&quot;noName&quot;>
<input type=hidden name=&quot;env_report&quot; value=&quot;REMOTE_HOST,REMOTE_ADDR,REMOTE_USER,HTTP_USER_AGENT,HTTP_REFERER&quot;>
</form>

</body>
 
Although I'm no expert on search engine spiders, I do not know of any javascript that could possibly screw up their work, so I would say no to the first question (although I'm not sure what you mean by &quot;the real stuff&quot;).

As far as another email program, I'm an ASP guy, myself, and yes, I do know an ASP component that you can use to send emails that is very simple to use, if you know (and can use on your server) just a little ASP. If you would like for me to post such a solution, then let me know, and I'll be happy to.

:-)
paul
penny.gif
penny.gif
 
>engcomp


afai remember, formmail has an option not to return html-generated-on-the-fly page..

there have to be something like return_html function(subroutine) check it, if it generates something, just delete (comment) those strings

leave just
print &quot;Location: $Config{'redirect'}\n\n&quot;;

'xcuse me if i understood you wrongly
 
If I have no redirect, formmail creates its own &quot;thank-you&quot; page. If I delete (comment out) those lines, it simply returns an empty page.

The object is that it should return to the page that has the hidden form on it - without triggering an infinite loop by triggering onLoad again.

BTW, I checked with AffordableHost and they don't run ASP or any other Microsoft product. However, I have access to the latest Perl and PHP.

Thank for your help, Helmut
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top