Home arrow Support arrow Forums
LimeSurvey Forums
Welcome, Guest
Please Login or Register.    Lost Password?
[done] Timestamp for individual answers. (1 viewing) (1) Guest
Go to bottom Favoured: 0
TOPIC: [done] Timestamp for individual answers.
#18728
dart (User)
Junior Lime
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
[done] Timestamp for individual answers. 3 Months, 3 Weeks ago Karma: 0  
Hi,

I need to timestamp each individual answer to determine how long it takes participant to answer each question. This is especially important after reading some text or website information. If they take longer then we can determine how well they may have read this previous information.

How would this be possible? I understand that surveys are submitted at the end. Is it possible to timestamp each answer and/or block?

I've enabled time stamp option for this survey but this isn't enough information i.e. only survey creation.
Also when does this time stamp happen? i.e. when the submit button is clicked?

Thanks
Dart
 
Logged Logged  
 
Last Edit: 2008/09/19 01:32 By Mazi.
  The administrator has disabled public write access.
#18736
Mazi (Moderator)
Moderator Lime
Posts: 3503
graph
User Online Now Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 3 Weeks ago Karma: 28  
The timestamp is recorded when the busson is clicked.

Only solution I can think of is to use a javascript timer which runs in the background and create a text field or numerical input field after each question and then somehow write the time recorded by javascript into this field. This implies that you use a question-by-question survey.

Take a look at manual -> wokrarounds to find out more about prefilling a form and javascript timer. Searching the forum might bring up additional information, too.
 
Logged Logged  
 
Last Edit: 2008/09/15 11:16 By Mazi.
 
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.
#18778
dart (User)
Junior Lime
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 3 Weeks ago Karma: 0  
Thanks for that.

I found some JavaScript code for the timer

www.javascript-page.com/timer.html

I tried to paste the timer demo in the workarounds section into the question text but it didn't work. Is this how you enable scripts?
Also I get the following error when I enable the survey now "Survey does not pass consistency check".

I couldn't find any procedure on how to add a javascript code other than it says to add in the question text but it doesn't work for me.

What I need to do is:
1. Start timer when question is displayed.
2. Record this timer value (same timer) when the Next button is clicked.

So will I need to have two seperately activated scripts. The first script is a boiler point question and I'll make sure it doesn't show with conditions. How do I make the next script happen when the next button click?

Its a pitty there isn't a "script" type question but prehaps I'm missing something.

HELP!!

Thanks
 
Logged Logged  
  The administrator has disabled public write access.
#18784
Mazi (Moderator)
Moderator Lime
Posts: 3503
graph
User Online Now Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 3 Weeks ago Karma: 28  
dart wrote:

I tried to paste the timer demo in the workarounds section into the question text but it didn't work. Is this how you enable scripts?

There is a filter for security reasons which filters javascript input to prevent XSS attacs. Check config-defaults.php for a setting like "xssfilter", copy this setting to config.php and disable the filter.

To put the recorded time into a textfields I recommend to show the textfield to the user and use javascript to directly place the time of the counter into the text field. This should be possible by addressing the form element directly (DOM).

Please keep in mind that I haven't done something like this before myself. I can only point you to how this should work.
You can try to contact other users who have successfully implemented a timer.
 
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.
#18909
dart (User)
Junior Lime
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 3 Weeks ago Karma: 0  
Hi Mazi,

Sounds like hard work given I only have say a day to get it running.
I might miss it and get up to speed with Java scripts in questions
for the next job

Thanks though.

P.S. Prehaps somebody could write something in the manual on a step by step on using Java with LimeSurvey?? Even step by step procedure for the
Java stuff in the workarounds section.
 
Logged Logged  
  The administrator has disabled public write access.
#18997
Mazi (Moderator)
Moderator Lime
Posts: 3503
graph
User Online Now Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 2 Weeks ago Karma: 28  
If you are missing some information in the manual feel free to improve it yourself. Our manual is a wiki, everyone can edit it and you can't do much wrong.
So if you miss anything in the manual and you found out how to do it please add this information. Thanks!
 
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.
#19005
dart (User)
Junior Lime
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 2 Weeks ago Karma: 0  
Looks like I have no choice now but to implement this feature as the research now requires it.

When I finish this I'll write it up

The following would be a nice feature for the future.
1. A script question type (No need to paste in question).
2. Have extra options to allow admin to insert data fields and capture certain event including key presses.
3. Only administrators can have access to edit/add scripts.
4. Some write a good manual on how to expand Limesurvey through JavaScipting

I need a little help on how to capture the "Next" button event so i can write the data to a researve field and continue with next buttons normal operation. Also how do I write this timer value to my spare field?? I'm guessing I need to know question ID but have no idea

Also is it possible to know when a URL link is clicked and start a timer then?
thanks!!
Dart
 
Logged Logged  
 
Last Edit: 2008/09/19 06:29 By dart.
  The administrator has disabled public write access.
#19025
Mazi (Moderator)
Moderator Lime
Posts: 3503
graph
User Online Now Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 2 Weeks ago Karma: 28  
You can add this as a feature request to the bugtracker. Please describe your problem/solution as detailed as possible.

Regarding the programming questions I recommend to join the developer IRC.

I can't help you with this in detail because I'm not a developer.
 
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.
#19178
dart (User)
Junior Lime
Posts: 26
graphgraph
User Offline Click here to see the profile of this user
Re:Timestamp for individual answers. 3 Months, 2 Weeks ago Karma: 0  
Hi,

I have a problem....

When my special question is hidden it won't write value to database.
A good way to test this is to:
1. Create special question and its conditional on another question. So you can hide/unhide it within the same page.
2. Set a value in this special question
3. Hide it
4. Click next or submit.
5. Check responses, hay no entry!!

The value doesn't get cleared either when you hide and unhide question
so it has to do with the submit form part to LimeSurvey.

I also tried forcing it to display just before the submit form is run but that didn't work either.

i.e. document.getElementById('question302'.style.display='';
document.getElementById('display302'.value='on';


I've attached as a txt file and pasted it.

Here's my code :

Question 01
<div id="LS_Timer" style="padding-right: 3px; padding-left: 3px; left: 25px; padding-bottom: 3px; padding-top: 3px; position: absolute; top: -25px; background-color: lime">&nbsp;</div>
<script type="text/javascript">

/***********************************************
* Darts Timer Question
* 23/Sept/2008
***********************************************/

var timecount = 0; // in seconds

function countup(){
timecount++;
var secs = timecount % 60; if (secs < 10) secs = '0'+secs;
var T1 = (timecount - 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 (timecount>0) setTimeout("countup()",1000);

}

function doSomething(e) {
if (!e) var e = window.event;
// alert('Event Captured :'+e.type); //Un-comment to see what event was called

if (e.type=='submit' {

// if ((document.getElementById('java76988X43X297'.value))

//Prehaps enable my question to see if it will write to database
document.getElementById('question302'.style.display='';
document.getElementById('display302'.value='on';

//Write timer value to hidden form label
document.getElementById('answer76988X43X302'.value=timecount;
}
}


function addEvent( obj, type, fn ) {
if ( obj.attachEvent ) {
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
} else
obj.addEventListener( type, fn, false );
}
function removeEvent( obj, type, fn ) {
if ( obj.detachEvent ) {
obj.detachEvent( 'on'+type, obj[type+fn] );
obj[type+fn] = null;
} else
obj.removeEventListener( type, fn, false );
}


/***********************************************
* Dock Content script- Created by and © Dynamicdrive.com
* This notice must stay intact for use
* Visit 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);
countup();

//Capture events for submit and click
addEvent(document.getElementById('limesurvey',"submit",doSomething); //this happens when Next button is clicked
addEvent(document.getElementById('limesurvey',"click",doSomething); //Any mouse click events

</script>
 
Logged Logged  
 
Last Edit: 2008/09/23 06:47 By dart.
  The administrator has disabled public write access.
Go to top