Pulling questions in a single page of jsPsychSurvey from timeline variables #3058
-
Hello jsPsych gurus, I have two questions relating to jsPsychSurvey:
Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
ChristopheBossens
Jun 4, 2023
Replies: 1 comment 1 reply
-
Hi mrinmayik, For your first question, do you mean that you want to fill in the pages property of the suvrey as a timeline variable? In that case, you could use code such as the one below to make that happen: const jsPsych = initJsPsych();
let timeline_questions = [
{
pages : [[{
type : 'html',
prompt : 'First page'
},
{
type: 'multi-choice',
prompt: "Which of the following do you like the most?",
name: 'VegetablesLike',
options: ['Tomato', 'Cucumber', 'Eggplant', 'Corn', 'Peas'],
required: true
},
]]},
{
pages : [[{
type : 'html',
prompt : 'Second page'
},
{
type: 'text',
prompt: "Two textboxes",
name: 'textbox_1',
},
{
type: 'text',
prompt: ' ',
name: 'textbox_2',
},
]]},
]
var trial = {
type: jsPsychSurvey,
pages: jsPsych.timelineVariable('pages')
};
let test_procedure = {
timeline : [trial],
timeline_variables : timeline_questions
}
jsPsych.run([test_procedure]); For your second question, a textbox question only has question. But you could create a second text question and use an empty prompt so that it looks as if you have two text boxes? |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mrinmayik
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi mrinmayik,
For your first question, do you mean that you want to fill in the pages property of the suvrey as a timeline variable? In that case, you could use code such as the one below to make that happen: