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

Auto submit form after 15 minutes 3

Status
Not open for further replies.

pinto19

Vendor
May 22, 2005
29
US
Hello all, let me ask your for some help.
I have a page which I use as assessment test. There are 20 questions and people have to pick correct answer from A, B, C or D. Currently I have them set up on 2 frames. Answers on the left and the questions on the right. The right frame has a script to count down to 15 min and after that time it changes and people have to click on the print button on the new page on the same frame and it prints the left frame (answers). I now am able to send the results to a database, so I could actually just have one frame and have a submit button. My problem with that is if I use the redirect timer script, it will just change to another page and people would not be able to submit their answers. Here is my question, is there such a script that will allow me to count down to 15 minutes and them autosubmit the form and then redirect to a different page?
Any assistance would be appreciated. Sorry about the long winded question, just wanted to make the thoughts clear to all.
 
You would be able to auto-submit the form after 15 mins, no problem... something like this:

Code:
setTimeout('document.forms[0].submit();', 900000);

You can either choose to do the redirect server-side, or just use the page you submit to to display the information the redirect page would have.

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
If it is needed to set up in the top controlling window keeping the answer page intact, then you can set it up in its onload handler with this line.
[tt] setTimeout("top.answerframename.document.formname.submit();",900000);[/tt]
 
Sorry to be ignorant, where would this code go, in the head or the body section of the page?
 
If the controlling page is like this.
[tt]
<html>
<body>
<iframe src="questionpage.htm" name="questionframename" .../>
<iframe src="answerpage.htm" name="answerframename" ... />
</body>
</html>
[/tt]
Then put it like this or some other equivalent structure.
[tt]
<body onload="setTimeout('top.answerframename.document.formname.submit();',900000);">
[/tt]
If you want to change answerpage.htm with some other page structure than the above. Then put the line BRPS suggested in the answerpage.htm's onload or some other equivalent structure.
[tt]
<!-- inside answerpage.htm -->
<body onload="setTimeout('document.formname.submit();', 900000);">
[/tt]
- tsuji
 
Here is what I have done with your suggestion. Changed the time to 10 seconds so that I can see the form working. I am just using one frame. Please tell me what I am doing wrong, 'cause its not working. I do appreciate your help.

<html>

<head>

<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body onload="setTimeout('document.b1.submit();', 10000);">
<form method="POST" action="new_page_1.asp" webbot-action="--WEBBOT-SELF--">
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0">
<p>1.<input type="text" name="T1" size="20"></p>
<p>2.<input type="text" name="T2" size="20"></p>
<p>3.<input type="text" name="T3" size="20"></p>
<p>4.<input type="text" name="T4" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>
 
>[tt]<form method="POST" action="new_page_1.asp" webbot-action="--WEBBOT-SELF--">
<form [red]name="b1"[/red] method="POST" action="new_page_1.asp" webbot-action="--WEBBOT-SELF--">[/tt]
 
After I change the first line with the 2nd line that you provided, it worked perfect. Thank you so much.
I appreciate the help.
 
The line was suggested by BRPS. I think he deserves more the star. What do you think?
 
Okay, BRPS ,have it on me. You deserve it.
- tsuji
 

Hehe thanks - you definately deserved one, too ;o)

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
I was at work all day, I showed it to my boss and she loved it. Thank you both for all your help. Appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top