Time limit for a series of survey text trials #2310
-
Hello! I've pored over past discussions and I haven't been able to find something like this. Is it possible? Thanks in advance! Here's what I've got so far (with 5s limit for testing), but I've unsuccessfully tried a variety of ways to get it to record the responses on time out. I also don't think this strategy would allow me to record the rt of each response. (Insert code function is not working properly for this so apologies for bad formatting) var time_limit = 5000;
var start_time2;
var end_test_timer;
var trial_count = 0;
var n_trials = 20;
var counter2 = 1;
var trial = {
timeline: [ {
timeline: [
{type: jsPsychSurveyText,
questions: [
{prompt: 'Probe', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40},
{prompt: ' ', placeholder: 'Type here', columns: 40}
],
randomize_question_order: false,
on_load: function() {
trial_count++;
if (trial_count > 0) {
start_time2 = performance.now();
var end_test_timer = setTimeout(function() {
var end_time = performance.now();
var elapsed_time = end_time - start_time2;
console.log("elapsed time: ", elapsed_time);
jsPsych.endCurrentTimeline();
jsPsych.finishTrial({status: "ended early"});
}, time_limit);
}
},
on_finish: function() {
counter2++;
if (trial_count == n_trials) {
clearTimeout(end_test_timer);
}
}
}
],
}]
};
jsPsych.run([trial]); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @michelleramey, great question. Do you need all of the text boxes to appear on the same page? Or one textbox per page, and the participant submits their response (key press or button click), which triggers the next textbox to appear? If the latter method is ok, my approach to this would be to have one survey-text trial that is inside of a loop node. Then in the loop function, you can check whether the time limit is up - if so then stop the loop, otherwise repeat the timeline (i.e. run another survey-text trial). The advantage of this showing one textbox per page is that it'll give you RTs for each response submission. Let us know if that approach sounds like it would work, and if you want any further guidance with the code. |
Beta Was this translation helpful? Give feedback.
Hi @michelleramey, great question. Do you need all of the text boxes to appear on the same page? Or one textbox per page, and the participant submits their response (key press or button click), which triggers the next textbox to appear? If the latter method is ok, my approach to this would be to have one survey-text trial that is inside of a loop node. Then in the loop function, you can check whether the time limit is up - if so then stop the loop, otherwise repeat the timeline (i.e. run another survey-text trial). The advantage of this showing one textbox per page is that it'll give you RTs for each response submission.
Let us know if that approach sounds like it would work, and if you w…