| Author |
Submitting a JSP page after a predefined Time limit
|
Anshul Mathur
Greenhorn
Joined: Nov 07, 2003
Posts: 22
|
|
Hello All I am making an online QUIZ for my College and want to include the feature that page automatically submits to a servlet/JSP after the time limit is exhausted. Thanks Anshul Mathur
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
This is one of the examples in my book that I am writing. You need to use a setTimeout() method, basic idea onload="setTimeout('document.formName.submit()',numMilliseconds)"; Eric
|
 |
Gaurav Jain
Ranch Hand
Joined: Mar 11, 2004
Posts: 108
|
|
You can use the setTimeout() function of javascript. Call the submit function from setTimeout and the page will b submitted after the predefined time limit. setTimeout('yourFunction()',3000) 3000 is time in millisecinds. Call the setTimeout function based on your condition/requirement.
|
 |
Anshul Mathur
Greenhorn
Joined: Nov 07, 2003
Posts: 22
|
|
Thanks a lot.
|
 |
Yuriy Fuksenko
Ranch Hand
Joined: Feb 02, 2001
Posts: 413
|
|
Keep in mind , that if user have access to address bar he could change that time thing. For Erics example If I type in address bar: the page will be submited only after I type in address bar
|
 |
Saumyaraj Zala
Ranch Hand
Joined: Aug 06, 2012
Posts: 30
|
|
I have a similar problem.
A user can finish quiz by clicking submit button or it will be submitted after a predefined time out.
Where to call the javascript method ontimeout?
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
Attach it to the window load event.
|
 |
 |
|
|
subject: Submitting a JSP page after a predefined Time limit
|
|
|