Hi,
I am trying to implement a sort of questionnaire. There is one question per "page" (each page is simply a div element that is rendered or not), and each page has a time limit. This means that I would like to show an ajax countdown in the page, and I want to automatically change the page when the time expires. I have no idea on how to implement this, since in my opinion it would involve a separate thread that takes care of the timing issue. And I wouldn't know what's the way to deal with threads in seaside. Do you have any pointer/suggestion for me? Thank you, Alberto _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I don't have a computer at hand right now, but there is a Pier
component (as far as I remember called Pier-Counter or Pier-Countdown) that does more or less that. The idea is to implement the counter in Javascript and have some extra validation (so that nobody can cheat) on the server. Lukas On Saturday, September 18, 2010, Alberto Bacchelli <[hidden email]> wrote: > Hi, > > I am trying to implement a sort of questionnaire. > There is one question per "page" (each page is simply > a div element that is rendered or not), and each page > has a time limit. > > This means that I would like to show an ajax countdown in the > page, and I want to automatically change the page when the > time expires. > > I have no idea on how to implement this, > since in my opinion it would involve a separate > thread that takes care of the timing issue. > And I wouldn't know what's the way to deal with > threads in seaside. > > Do you have any pointer/suggestion for me? > > Thank you, > Alberto > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > -- Lukas Renggli www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Alberto Bacchelli
If you want to do it from the seaside
side, you could use Comet (the "self pusher" below).
When the question is rendered, start a timer: startTimerProcess timerProcess := [ [ (Delay forSeconds: howLong) wait. self pusher javascript: [ :script | script << (script jQuery: #whatsHisName) load html: [ :h | ...update with new content...] ]. ]. timerProcess := nil. ] forkAt: Processor userBackgroundPriority. If the timer expires, the script << (script jQuery: #whatsHisName) ...update with new content... could move to the next question. If the user answers before the time expires, then kill the timer and start a new one (if needed) timerProcess terminate. timerProcess := nil. self startTimerProcess. Cheers, Bob On 9/18/10 11:44 AM, Alberto Bacchelli wrote: Hi, _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |