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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically Post Form

Status
Not open for further replies.

madhouse

Programmer
Sep 17, 2002
165
GB
Does anyone know whether it's possible to automatically post a form without having a user click a submit button?

I have one form that users will complete/submit and the results will be saved to a database. Some of the values from this first form will be used as the values for a second form which the users will not see. It's this second form that I want posted automatically after the first form has been processed. Why do I need this?? Well the results of the second form are posted to a different server than what the web site resides on.
 

[tt]

google.gif
[sup]"I don't even know if there's a light at the end of the tunnel. I just walked in."
-Me​
 
DeCojute - not sure what I should be looking at from the link you gave me??
 
the link is hits on auto submitting form's. is that what you are asking?

the user will have to do some sort of event for the form to be submitted. it doesn't have to be a button click and there are many variations to how you can catch a event and submit the form. perhaps "post" is the wrong terminology to use here. seeing as you state the user does not see this process what are you refering to by post? submit the form containing hidden fields again in the second page on a event?

_____________________________________________________________________
onpnt2.gif
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
Basically I have a form that posts to itself so that a record can be added to the database. There are 3 fields in this form (name, email & address) that then need to be submitted as hidden fields on the second form. But I don't users to have to manually submit the second form. So by a user submitting the first form the record will be added and then the second form posted without the users intervention - so to the user it will just look as though they've submitted one form.
 
then DeCojute understood you correctly and the link provided on a google search of dynamic ways to submit the hidden form is perfect and should give you plenty to go on. the only thing you need to figure out is at which event to do the submission.

Note: don't confuse me saying "which event" for a manual submission that the user is doing jsut for that form. it could be a unLoad event, a link click etc.... that goes or calls something other then that submision

_____________________________________________________________________
onpnt2.gif
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
Thanks for your help...I found a way of doing it!!

The first form now posts to a different page (post.asp) which adds a record to the database. In this same page I have the second form whose hidden values are taken from the first form. I've then got the following piece of Javascript code which will automatically post this second form:

<script language=&quot;javascript&quot;>
document.MyForm2.submit()
</script>
 
[thumbsup2] glad you found a solution

_____________________________________________________________________
onpnt2.gif
[sub]
The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top