+xHi!
I'm trying to have a survey where, if the participant responds with "Guilty", then they get sent to another set of survey pages, and if they respond "Not guilty" they get sent to a different set of survey pages. However, whenever I try to branch within the survey, the first question (the verdict question) is skipped over and it goes straight to the next survey. It then seems to get stuck in an infinite loop. Is there a way to fix this? Here is what the script looks like:
<survey verdict>
/ pages=[1=verdict1]
/ showbackbutton=false
/ screencolor = white
/ branch = [
if (surveypage.verdict.response == "Guilty") survey.guiltysurvey else survey.notguiltysurvey
]
</survey>
<surveypage verdict1>
/questions = [1 = verdict1]
/showpagenumbers = false
/showquestionnumbers = false
/ nextbuttonposition = (90%, 90%)
/ navigationbuttonfontstyle = ("Arial", 1.5%, true, false, false, false, 5, 0)
</surveypage>
<radiobuttons verdict1>
/caption ="What would your verdict be as a juror in this case?"
/ fontstyle = ("Arial", 4%, true, false, false, false, 5, 0)
/ txcolor = black
/ options = ("Not Guilty", "Guilty")
/ order = random
/required = true
/orientation = horizontal
/ responsefontstyle = ("Arial", 3.5%, true, false, false, false, 5, 0)
/ position = (10%, 25%)
/ size = (500,500)
</radiobuttons>
<survey guiltysurvey>
/ pages = [1=confidence; 2=sentence1; 3=fine1; 4=verdictchangeguilty; 5=sentence2addict; 6=fine2addict]
/ showbackbutton = false
/ screencolor = white
</survey>
<survey notguiltysurvey>
/ pages = [1=confidence; 2=sentence1; 3=fine1; 4=verdictchangenotguilty; 5=sentence2addict; 6=fine2addict]
/ showbackbutton = false
/ screencolor = white
</survey>
#1:
<survey verdict>
/ pages=[1=verdict1]
/ showbackbutton=false
/ screencolor = white
/ branch = [
if (surveypage.verdict.response == "Guilty") survey.guiltysurvey else survey.notguiltysurvey
]</survey>
The /branch condition seems wrong. A <surveypage> has no response property. You'll want radiobuttons.verdict1.response; there also isn't any <survepage> called verdict in the code you posted, there is only a page called verdict1.
#2: You need an <expt> element to control in which order the script is supposed to run the surveys (a <survey> is a type of <block>). Otherwise the running the script will execute all <survey>s in alphabetical order.
<expt>
/ blocks = [1=verdict]
</expt><survey verdict>
/ pages=[1=verdict1]
/ showbackbutton=false
/ screencolor = white
/ branch = [
if (
radiobuttons.verdict1.response == "Guilty") survey.guiltysurvey else survey.notguiltysurvey
]
</survey>
<surveypage verdict1>
/questions = [1 = verdict1]
/showpagenumbers = false
/showquestionnumbers = false
/ nextbuttonposition = (90%, 90%)
/ navigationbuttonfontstyle = ("Arial", 1.5%, true, false, false, false, 5, 0)
</surveypage>
<radiobuttons verdict1>
/caption ="What would your verdict be as a juror in this case?"
/ fontstyle = ("Arial", 4%, true, false, false, false, 5, 0)
/ txcolor = black
/ options = ("Not Guilty", "Guilty")
/ order = random
/required = true
/orientation = horizontal
/ responsefontstyle = ("Arial", 3.5%, true, false, false, false, 5, 0)
/ position = (10%, 25%)
/ size = (500,500)
</radiobuttons>
<survey guiltysurvey>
/ pages = [1=confidence; 2=sentence1; 3=fine1; 4=verdictchangeguilty; 5=sentence2addict; 6=fine2addict]
/ showbackbutton = false
/ screencolor = white
</survey>
<survey notguiltysurvey>
/ pages = [1=confidence; 2=sentence1; 3=fine1; 4=verdictchangenotguilty; 5=sentence2addict; 6=fine2addict]
/ showbackbutton = false
/ screencolor = white
</survey>