Skip to content

present next trial based on condition #776

Answered by jodeleeuw
Stajduhar-A asked this question in Q&A
Discussion options

You must be logged in to vote

Sounds like the survey trial should be wrapped in a conditional timeline. The example on the docs page is very similar to what you need to do. Copying it here for ease of reference:

var pre_if_trial = {
    type: 'html-keyboard-response',
    stimulus: 'The next trial is in a conditional statement. Press S to skip it, or V to view it.'
}

var if_trial = {
    type: 'html-keyboard-response',
    stimulus: 'You chose to view the trial. Press any key to continue.'
}

var if_node = {
    timeline: [if_trial],
    conditional_function: function(){
        // get the data from the previous trial,
        // and check which key was pressed
        var data = jsPsych.data.get().last(1).values()[0];

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Stajduhar-A
Comment options

@jodeleeuw
Comment options

@Stajduhar-A
Comment options

Answer selected by Stajduhar-A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants