Results 1 to 12 of 12

Thread: Timer in Form Question

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Location
    New York
    Posts
    679

    Timer in Form Question

    I need to create a simple form that will give the user multiple choice questions...but the user only has so much time to complete the form..

    Now here is where I am having a problem...I would need for the form at the end of the timer to intiate the SUBMIT button as if the user did it...this way it will capture the answers the user was able to complete..

    Could someone assist me with getting this ball rolling? I am working within an INTRANET environment.

    Thank you.

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Well

    I usually do it with JavaScript... Make a JS timer and use 'window.location' to compensate for the submit button(keep in mind you need to send the vars manually)


    Cheers!
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  3. #3
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    By chance I wrote a quiz llast night for something else. It isn't exactly as you want it, but it is very easy to edit it. All you have to do is: if they have not entered anything as the timer runs out enter a letter which is wrong. then post the data like normally.
    Attached Files Attached Files
    Have I helped you? Please Rate my posts.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Location
    New York
    Posts
    679
    Acidic,

    I looked at your quize, and I was curious...I could not see where the score of either the incorrect or correct answers were sent to the summary html page?

    I would like to create somthing similar...I would like ( if possible) to have an html quize page and then on submit send the answers the user selected along with the correct answers and a score to another html page...

    Maybe if I explain a little better...I have Managers who would like to quize their staff online, and then be able to view thier responses..I can not use CGI...I need a way for the Managers to go to an HTML page to see the results of the respect ive quizes...

    Can this be done, if so how do I get the results to stay on the Summary HTML page?

  5. #5
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    on the first page:
    Code:
    ...
    		location.href = "quiz2.html?points=1" //Go here, note the bit after the question mark, thats the query string
    		}
    	else
    		{
    		location.href = "quiz2.html?points=0" //If they were wrong go here, not the query string now too.
    ...
    the "points=" bit is where the number of pionts is sent to the next page. On page 2 it is the same place but slightly more complex as it has to take into account what the user got for the first question.

    BTW, this quiz could also be made all on one page, that would make it much easier to code as ou don't have to worry about query strings.

    Just reply if you want it like that.
    Have I helped you? Please Rate my posts.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2001
    Location
    New York
    Posts
    679
    Yea, I would have it all on one page since I will only be asking a gew multiple choice questions....

    But what about the users answers, the correct answers and the overall score be placed on a seperate HTML page...and even further is it possible for this info to stay on the page so that the Managers can go there to see their staff's score?

    If not what suggestions would you have?

    Thank you very much!!

  7. #7
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    no, the results can't stay there. JavaScript cannot permanently change anything. you would need a server side language like ASP or PHP. intranets should do that but I can't do it.

    I'll get onto making the script all on one page.

    edit: Actually I'm having problems making the script, either some1 else can make it or I'll post you one I made earlier on monday (It's on the school network)
    Last edited by Acidic; Nov 21st, 2003 at 03:20 PM.
    Have I helped you? Please Rate my posts.

  8. #8
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Point out to the managers that employees can cheat by disabling JavaScript, which would give them infinite time. There are a few ways around this:
    1) Use more Javascript, so that the quiz doesn't work at all if JS is disabled.
    2) Watch the users while they do the test (pretty much ruins the online benefits though).
    3) Add some server-side checking. The server records when the page is sent to the user (best done in the user database). When the page comes back, it records the time again. Just calculate the difference and check if the user took to long.
    In a web environment it would be unfair for small timeframes because of possible page loading delay, but that's negligible in an intranet.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  9. #9
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    even with that it is possible to cheat:
    eg. I could type:
    javascript:document.getElementById('points').value = '500'
    into the address bar and voila, I'm getting the next raise.
    Have I helped you? Please Rate my posts.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I didn't look at how this is implemented.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    But if the score calculation is done client-side, it's extremly easy to cheat. For example I could write a miniscule "web browser" that simply sends a HTTP request for the results page to the server, passing a high score.

    Or I could check the page source to find out which answers score highest.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  12. #12
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    It hasn't been implemented yet. I haven't done the script. He wanted it all on one page. I tried, I got errors, I delayed. Until monday when I can get one I did earlier on school network.
    Have I helped you? Please Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width