Portada arrow Soporte arrow Forums
LimeSurvey Forums
Welcome, Guest
Please Login or Register.    Lost Password?
Re:set timer on a question? (1 viewing) (1) Guest
Go to bottom Favoured: 1
TOPIC: Re:set timer on a question?
#18366
mbo (User)
Fresh Lemon
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
set timer on a question? 2 Months, 2 Weeks ago Karma: 0  
Hello All,

I've been looking for an answer on this one but wasn't finding what I needed, so thanks in advance for any help that anyone can provide.

What I would like to do is present a "stimulus" on a boiler-plate (e.g., instructions, an image, etc.), and make it so that the page would be presented for a given amount of time. For example, a participant in the study might come to a part in the survey where they are given 30 seconds to look at an image, and then the survey automatically moves on to the next question. I want to be able to set the amount of time, to prevent the participant from "moving on" to the next question without waiting, etc.

If anyone has any thoughts or if this has already been discussed, any direction would be great!

Thanks so much.

Kind regards,

Mary
 
Logged Logged  
  The administrator has disabled public write access.
#18387
psycolor (User)
Junior Lime
Posts: 39
graphgraph
User Offline Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 0  
hello Mary,

this is a complex one and as you I haven't find a perfect solution yet, but i can offer a workaround based on CSS and javascript. have a look at this survey:

capisci.org.uk/Y2limes/index.php?sid=22445&lang=en
or
capisci.org.uk/Y2limes/index.php?sid=14666&lang=en

the principle is similar and the reverse is possible (i.e. hiding the next button until the time has passed), but it is requiring some fiddling with the code. depending on how technical you are, in recent time i've looked at jquery, and this might also offer interesting applications and workaround using the styles and the jquery library.

if this is what you are after i can give you more details.

lorenzo
 
Logged Logged  
  The administrator has disabled public write access.
#18397
ElMatador69 (Moderator)
LimeSurvey Team
Posts: 1577
graphgraph
User Online Now Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 31  
Have a look at the attached survey structure of this ticket:
http://bugs.limesurvey.org/view.php?id=1199
 
Logged Logged  
 
Get in touch with the LimeSurvey Development Team via IRC
If our informations and answers were useful to you, please consider a donation to the LimeSurvey Project!
  The administrator has disabled public write access.
#18403
psycolor (User)
Junior Lime
Posts: 39
graphgraph
User Offline Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 0  
This is quite ingenious to submit automatically within the time limit!

In my case we wanted to show the question for X amount of time and then allow people to submit in their own time.

When i tried i had problem to embed all the javascript in the question which caused IE6 to break, but this was possbly because i was manipulating div layers and for this the javascript has to go in the head of the document.

i guess that with a little more work you could have control of both the presentation and response timed!
 
Logged Logged  
  The administrator has disabled public write access.
#18410
mbo (User)
Fresh Lemon
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 0  
Hi everyone,

WOW! I'm just so appreciative of your responses. That's just the greatest. Thank you!!!

So I fooled around with it a little today. Basically I want to give instructions as part of an experiment that involves mood induction.

Here's what I've got so far:

research.comm.psu.edu/limesurvey/index.p...id=81219&lang=en

But please be kind! I'm a newbie here and so am fumbling a bit.

This is really just a draft thing, and so there are typos, etc. But basically what I did was use ElMatador69's script and put a lot of hard returns into the the question so that the "next" button wasn't visible. I only set the thing on a really quick timer because I'm just testing it out here. And the music was just a kicker. Stick fooling around with it.

Also, lorenzo, your examples looks awesome. I would really love to learn more -- and particularly for the second example.

Thanks again everyone!

Best,

Mary
 
Logged Logged  
  The administrator has disabled public write access.
#18444
Mazi (Moderator)
Moderator Lime
Posts: 3262
graph
User Offline Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 25  
Very nice examples. We should really try to put this together to have some detailled instructions in the workarounds section of the manual.
Any volunteers?
 
Logged Logged  
 
Best regards,
Mazi
______________________
Need help? I can: set up Limesurvey for you / create your survey / implement additional features / design your template / offer premium support -> Contact.
  The administrator has disabled public write access.
#18461
psycolor (User)
Junior Lime
Posts: 39
graphgraph
User Offline Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 0  
I'm happy to document this workaround; i guess that if it is clear enough it could be integrated in the next version with a new question type that 'wraps' around the normal questions, but it might need more though.

lorenzo
 
Logged Logged  
  The administrator has disabled public write access.
#18463
Mazi (Moderator)
Moderator Lime
Posts: 3262
graph
User Offline Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 25  
Great! Just edit the wiki/manual. If you have any questions feel free to contact me.
 
Logged Logged  
 
Best regards,
Mazi
______________________
Need help? I can: set up Limesurvey for you / create your survey / implement additional features / design your template / offer premium support -> Contact.
  The administrator has disabled public write access.
#18464
psycolor (User)
Junior Lime
Posts: 39
graphgraph
User Offline Click here to see the profile of this user
Re:set timer on a question? 2 Months, 2 Weeks ago Karma: 0  
Am i just being stupid or the wiki markup is not letting you write a full bit of javascript code without using the relevant markup? I just posted it here for now:

Code:


Question 01

<div id="LS_Timer" style="position:absolute;top:-25px;left:25px;background-color: lime; padding: 3px;"></div>
<script type="text/javascript">  
var timeleft = 5; // in seconds
function countdown(){
     timeleft--;
     var secs = timeleft % 60; if (secs < 10) secs = '0'+secs;
     var T1 = (timeleft - secs) / 60;
     var mins = T1 % 60; if (mins < 10) mins = '0'+mins;
     var hours = (T1 - mins) / 60; if (hours < 10) hours = '0'+hours;
     document.getElementById("LS_Timer").innerHTML = hours + ':' + mins +':'+ secs;
     if (timeleft>0){
          setTimeout("countdown()",1000);
     }
     else{
          alert("out of time"); 
          document.limesurvey.submit();
     }
}

/***********************************************
* Dock Content script- Created by and © Dynamicdrive.com
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full script
***********************************************/

var offsetfromedge=0      //offset from window edge when content is "docked". Change if desired.
var dockarray=new Array() //array to cache dockit instances
var dkclear=new Array()   //array to cache corresponding clearinterval pointers

function dockit(el, duration){
this.source=document.all? document.all[el] : document.getElementById(el);
this.source.height=this.source.offsetHeight;
this.docheight=truebody().clientHeight;
this.duration=duration;
this.pagetop=0;
this.elementoffset=this.getOffsetY();
dockarray[dockarray.length]=this;
var pointer=eval(dockarray.length-1);
var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
eval(dynexpress);
}

dockit.prototype.getOffsetY=function(){
var totaloffset=parseInt(this.source.offsetTop);
var parentEl=this.source.offsetParent;
while (parentEl!=null){
totaloffset+=parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function dockornot(obj){
obj.pagetop=truebody().scrollTop;
if (obj.pagetop>obj.elementoffset) //detect upper offset
obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge+"px";
else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge+"px";
else
obj.source.style.top=0;
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

var dock0=new dockit("LS_Timer", 0);    
countdown();
</script> 


 
Logged Logged  
 
Last Edit: 2008/09/09 16:30 By Mazi.
  The administrator has disabled public write access.
Go to top