Millisecond Forums

Conditional branching back to survey page after incorrect survey question response

https://forums.millisecond.com/Topic25789.aspx

By ashleym - 9/27/2018

Hello,

I am trying to redirect participants to a previous set of three survey pages (one "Please try again" page, and then a repeat of a stimulus image (shown on its own page) and then a question about that image (shown on the next page) if they answer a survey question incorrectly. Participants will first be presented with an image, on the next page they will be asked one question about the image. If they answer incorrectly, they need to be redirected to a "Please try again" page, followed by the image page and the question page. This should repeat until the participant selects the correct answer, at which point they should move forward to the next block.  I am new to coding script and I tried to look over previous forum questions about conditional branching and redirecting to trials, but I am not sure if this relates to survey pages. Any help would be greatly appreciated!

Thank you!!

I have the following related code in my script:

Here is the one question that participants need to answer (correct answer is 1, all other answers need to redirect):

<radiobuttons question1>
/ caption = "instructions"
/ options = ("response", "response", "response", "response", "response")
/ optionvalues = ("1", "2", "3", "4", "5")
/ validresponse = ("1", "2", "3", "4", "5")
/ correctresponse = ("1")
</radiobuttons>

<surveypage page1>
/ stimulusframes = [1=image]
</surveypage>

<surveypage page2>
/ caption = "instructions"
/ questions = [1=question1;]
/ branch = [if(radiobuttons.question1.response != "1") block.block2]
</surveypage>

<surveypage page3>
/ caption = "Please Try Again"
</surveypage>

<block block1>
/ trials = [1 = page1; 2 = page2;]
</block>

<block redirect>
/ stop = [block.redirect.error]
/ branch = [if (block.redirect.error) block.redirect]
/ trials = [1 = page3; 2 = page1; 3 = page2;]
</block>

<block block2>
/ trials = [1 = pagex;]
</block>

By Dave - 9/27/2018

ashleym - Thursday, September 27, 2018
Hello,

I am trying to redirect participants to a previous set of three survey pages (one "Please try again" page, and then a repeat of a stimulus image (shown on its own page) and then a question about that image (shown on the next page) if they answer a survey question incorrectly. Participants will first be presented with an image, on the next page they will be asked one question about the image. If they answer incorrectly, they need to be redirected to a "Please try again" page, followed by the image page and the question page. This should repeat until the participant selects the correct answer, at which point they should move forward to the next block.  I am new to coding script and I tried to look over previous forum questions about conditional branching and redirecting to trials, but I am not sure if this relates to survey pages. Any help would be greatly appreciated!

Thank you!!

I have the following related code in my script:

Here is the one question that participants need to answer (correct answer is 1, all other answers need to redirect):

<radiobuttons question1>
/ caption = "instructions"
/ options = ("response", "response", "response", "response", "response")
/ optionvalues = ("1", "2", "3", "4", "5")
/ validresponse = ("1", "2", "3", "4", "5")
/ correctresponse = ("1")
</radiobuttons>

<surveypage page1>
/ stimulusframes = [1=image]
</surveypage>

<surveypage page2>
/ caption = "instructions"
/ questions = [1=question1;]
/ branch = [if(radiobuttons.question1.response != "1") block.block2]
</surveypage>

<surveypage page3>
/ caption = "Please Try Again"
</surveypage>

<block block1>
/ trials = [1 = page1; 2 = page2;]
</block>

<block redirect>
/ stop = [block.redirect.error]
/ branch = [if (block.redirect.error) block.redirect]
/ trials = [1 = page3; 2 = page1; 3 = page2;]
</block>

<block block2>
/ trials = [1 = pagex;]
</block>


What you'll want to do is:

- branch from page2 to page3 in case of a wrong response, and then
- re-run block1 by branch-ing from block1 back again to block1 in case of a wrong response.

The thing to remember is that /branch-es must remain on the same "level":
- A <trial> can only /branch to another <trial>, it cannot /branch to a <block>.  A <surveypage> is a special kind of <trial>.
- A <block> can only /branch to a <block>, it cannot /branch to a <trial>. A <survey> is a special kind of <block>.


<radiobuttons question1>
/ caption = "instructions"
/ options = ("response", "response", "response", "response", "response")
/ optionvalues = ("1", "2", "3", "4", "5")
</radiobuttons>

<surveypage page1>
/ stimulusframes = [1=image]
</surveypage>

<text image>
/ items = ("Placeholder for the image.")
</text>

<surveypage page2>
/ caption = "instructions"
/ questions = [1=question1;]
/ branch = [if(radiobuttons.question1.response != "1") surveypage.page3]
</surveypage>

<surveypage page3>
/ caption = "Please Try Again"
</surveypage>

<block block1>
/ trials = [1 = page1; 2 = page2;]
/ branch = [if(radiobuttons.question1.response != "1") block.block1]
</block>

<surveypage pagex>
/ caption = "This is the 2nd block"
</surveypage>


<block block2>
/ trials = [1 = pagex;]
</block>

<expt>
/ blocks = [1=block1; 2=block2]
</expt>
By ashleym - 9/27/2018

Dave - Thursday, September 27, 2018
ashleym - Thursday, September 27, 2018
Hello,

I am trying to redirect participants to a previous set of three survey pages (one "Please try again" page, and then a repeat of a stimulus image (shown on its own page) and then a question about that image (shown on the next page) if they answer a survey question incorrectly. Participants will first be presented with an image, on the next page they will be asked one question about the image. If they answer incorrectly, they need to be redirected to a "Please try again" page, followed by the image page and the question page. This should repeat until the participant selects the correct answer, at which point they should move forward to the next block.  I am new to coding script and I tried to look over previous forum questions about conditional branching and redirecting to trials, but I am not sure if this relates to survey pages. Any help would be greatly appreciated!

Thank you!!

I have the following related code in my script:

Here is the one question that participants need to answer (correct answer is 1, all other answers need to redirect):

<radiobuttons question1>
/ caption = "instructions"
/ options = ("response", "response", "response", "response", "response")
/ optionvalues = ("1", "2", "3", "4", "5")
/ validresponse = ("1", "2", "3", "4", "5")
/ correctresponse = ("1")
</radiobuttons>

<surveypage page1>
/ stimulusframes = [1=image]
</surveypage>

<surveypage page2>
/ caption = "instructions"
/ questions = [1=question1;]
/ branch = [if(radiobuttons.question1.response != "1") block.block2]
</surveypage>

<surveypage page3>
/ caption = "Please Try Again"
</surveypage>

<block block1>
/ trials = [1 = page1; 2 = page2;]
</block>

<block redirect>
/ stop = [block.redirect.error]
/ branch = [if (block.redirect.error) block.redirect]
/ trials = [1 = page3; 2 = page1; 3 = page2;]
</block>

<block block2>
/ trials = [1 = pagex;]
</block>


What you'll want to do is:

- branch from page2 to page3 in case of a wrong response, and then
- re-run block1 by branch-ing from block1 back again to block1 in case of a wrong response.

The thing to remember is that /branch-es must remain on the same "level":
- A <trial> can only /branch to another <trial>, it cannot /branch to a <block>.  A <surveypage> is a special kind of <trial>.
- A <block> can only /branch to a <block>, it cannot /branch to a <trial>. A <survey> is a special kind of <block>.


<radiobuttons question1>
/ caption = "instructions"
/ options = ("response", "response", "response", "response", "response")
/ optionvalues = ("1", "2", "3", "4", "5")
</radiobuttons>

<surveypage page1>
/ stimulusframes = [1=image]
</surveypage>

<text image>
/ items = ("Placeholder for the image.")
</text>

<surveypage page2>
/ caption = "instructions"
/ questions = [1=question1;]
/ branch = [if(radiobuttons.question1.response != "1") surveypage.page3]
</surveypage>

<surveypage page3>
/ caption = "Please Try Again"
</surveypage>

<block block1>
/ trials = [1 = page1; 2 = page2;]
/ branch = [if(radiobuttons.question1.response != "1") block.block1]
</block>

<surveypage pagex>
/ caption = "This is the 2nd block"
</surveypage>


<block block2>
/ trials = [1 = pagex;]
</block>

<expt>
/ blocks = [1=block1; 2=block2]
</expt>

simply re-run the <block>, by /branch-ing from <block>

Thank you so much for explaining that! It works! I really appreciate the help.