> I have an app that is for online test taking. Most online test > are 30 mins to 2hrs. I need to create count down clock from > when the test is stared. If 30 mins test, then count down will > start from 30 mins : 00 Secs, 29 min: 59 secs and so on. How > do I do this?
In a word: unreliably. Common attempts make use of JavaScript and Meta-refresh hacks. However, unless you control the browser environment (such as a testing lab), these can be readily disabled. I run FireFox with the NoScript and RefreshBlocker plugins, both of which prevent unsolicited "push" activity. Anybody who puts a meta-refresh on a page containing form-input should be smacked. As for scripts, nothing prevents a test-taker from using a JS debugger to increase the allowed time. The only way to come close to doing something of the like is to track all time on the server side, from the initial page delivery. Once the time on the server surpasses (initial_time + time_delta) the server reacts accordingly to submissions. This would be the only Django-related issue for the most part. In this case, clicking on the "begin the test" form button would post back to the server, allowing you to create a "test" entry containing the current time, and then redirect the resulting page to change the POST to GET so that reloads to re-post back the test request. Disadvantages: * a person can start the test, have a personal issue (such as a restroom break, medical issue, or what have you) and step away from the computer without realizing that the timer is still ticking. Or network difficulties (dropped aircard connection, back-hoe interruptus, ISP difficulties, FAA requirements for turning off wireless devices before takeoff, etc) * if all your questions are on one page, and they submit the whole thing a fraction of a second after the time expires, and they get no credit for any of their answers * if you have a page for each question (preventing the previous problem) you then have to take into consideration page-load times if, for example, the person is on a slow dialup or aircard connection. If your test is 30 minutes and 5 of those are spent transferring pages over a slow connection, is the test-taker penalized? One's not precluded from using a combination of the above in concert, so you can use the server-side stuff, with client-side JS that will update a count-down timer in a <div> somewhere, or to submit the form when time's up. Just don't rely on functionality that may not be there. Just a few thoughts for your consideration. -tkc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---