Google Answers Logo
View Question
 
Q: Time-Limited Quiz - Auto-submit form after 30 seconds ( No Answer,   1 Comment )
Question  
Subject: Time-Limited Quiz - Auto-submit form after 30 seconds
Category: Computers > Programming
Asked by: eco_jonathan-ga
List Price: $20.00
Posted: 30 Apr 2004 21:56 PDT
Expires: 03 May 2004 10:47 PDT
Question ID: 339252
I am developing a website which includes a time-limited quiz.  Can you
develop the code so a form will automatically-submit after 30 seconds?
 
The test consists of the following:
Page 1: identification login  (retained as a session variable, or
equivalent, and stamped into the form results for pages 2 and 3)
Page 2: time-limited test 
Page 3: non-timed test.

optional: The test should disappear (not be saved to the user's temp
files, and preferably be dynamically-generated 'on-the-fly' so users
cannot save the page via 'view source'). I am able to generate ".inc"
include pages myself, but I may encounter problems trying to integrate
the code you supply with my limited knowledge of include pages.

My project will enable people to perform tests without having to
commute to my small business's office.
 
My webhost service uses:
Linux
Apache
MySQL (preferably not)
PHP/Perl/Javascript/CGI 
My service is not capable of handling Cold Fusion or ASP. 

I can supply some of my research results if necessary. (Do not just
Google search for 'time-limit quiz' or variations, and don't just
search for 'quiz software' - neither of these types of searches
yielded the appropriate result).

Request for Question Clarification by mmastrac-ga on 01 May 2004 21:51 PDT
Hi eco_jonathan-ga!

Just to clarify - are you asking for a full implementation (generation
of the test server-side plus client-related information), or just the
client-side code required to take the HTML test page that you have
written (and/or generated) and make it submit after 30 seconds?

Thanks!
mmastrac-ga

Clarification of Question by eco_jonathan-ga on 02 May 2004 06:18 PDT
I need some server-side and some client-side programming, I think. To clarify:

  I designed the test pages, and have taken the test a few times. The
form data is saved to a file in a private directory, and is also
emailed to me.  So that part works.
  (I am not able to get the 3 forms' data to merge into one email, and
instead of getting 3 emails, I chose to have only 1 form send an
email, which I use as notification that test data is available in the
private file online.)

  To process the test data into scores, I copy-and-paste the data into
an Excel spreadsheet, which is configured to automatically parse the
data and calculate the scores.  This part also works.
  (Ideally, the scores would be calculated automatically via backend
processing (while retaining records of the raw test data), so that I
don't need to copy and paste the data into Excel, but I only expect
this test to be taken on average twice per week, so it's not a big
concern.)

Conceptually, here is the test:
Page 1: text boxes for registration/login, submitted by clicking 'Submit'.
Page 2: multiple choice with radio buttons, - this is the one which
needs to be auto-submitted after the time-expiry, but currently it is
submitted by clicking 'Submit'
Page 3: multiple choice with radio buttons, submitted by clicking 'Submit'.

I used MS FrontPage to design the tests, so the Form code reads:
<form method="POST" action="--WEBBOT-SELF--" name="FrontPage_Form1"
onsubmit="return FrontPage_Form1_Validator(this)"
language="JavaScript">
  <!--webbot bot="SaveResults" startspan U-File="private/spatial_data.htm"
  S-Format="HTML/BR" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
  U-File="private/spatial_data.txt" S-Format="TEXT/CSV" S-Label-Fields="TRUE"
  B-Reverse-Chronology="FALSE" S-Email-Format="TEXT/PRE"
  S-Email-Address="jonsbulkmail@sympatico.ca" B-Email-Label-Fields="TRUE"
  B-Email-Subject-From-Field="FALSE"
  S-Email-Subject="Test Data - Spatial Reasoning" S-Date-Format="%Y-%m-%d"
  S-Time-Format="%I:%M:%S %p"
  S-Builtin-Fields="REMOTE_NAME REMOTE_USER HTTP_USER_AGENT Date Time" -->
<input TYPE="hidden" NAME="VTI-GROUP" VALUE="0">
<!--webbot bot="SaveResults" endspan -->

I also set validation requirements for all the questions:
So question #1's options are coded:
<!--webbot bot="Validation" B-Value-Required="TRUE" -->
<input type="radio" value="V1" name="R1">&nbsp;
<input type="radio" value="V2" name="R1">&nbsp;
<input type="radio" value="V3" name="R1">

If you are not familiar with FrontPage and how it converts webbots
into standard form handlers and javascript, I will send more details.

Clarification of Question by eco_jonathan-ga on 03 May 2004 08:43 PDT
*** Timeout ***
I implemented RDF's comment, and it works!
For a moment, I thought it exposed a greater problem - at every
timeout the validation check advised me to return to the form to
answer the unanswered questions, and I got an extra 30 seconds, ad
infinitum!  Then I realized I no longer needed the validations.

*** Validations ***
I have determined that the validations are no longer necessary, since
the program identifies unanswered questions (an older version just
skipped them, so, for example, the answer to Q#15 was recorded as the
answer to Q#14, etc.)

Clarification of Question by eco_jonathan-ga on 03 May 2004 10:44 PDT
This question will re-appear shortly, updated.  I am cancelling this
question for now.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Time-Limited Quiz - Auto-submit form after 30 seconds
From: rdf-ga on 03 May 2004 07:22 PDT
 
To get the form to automatically submit after a fixed amount of time,
place this code into the HTML file:

<script>
	setTimeout("FrontPage_Form1.submit()", 30000);
</script>

setTimeout() makes JavaScript call a function after a specified time.
In this case, the function is the submit() function of your form
(calling this makes the form submit itself). The delay here is 30000
(milliseconds), or 30 seconds.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy