+xHi, I am trying to show "inst1", then "english". If participants do not answer they know English, they should be redirected to an end page. If they check they know English, they should be directed to "survey.demo". Afterwards, they should see "inst_cont". However, the branch is not working as after "english", participants see inst_cont regardless of the answer. I have tried doing the same with numbers (eg. english.response <=4) and correct.response, with no success. This is an excerpt of the relevant code part:
<survey inst>
/pages=[1= inst1; 2= english]
/ branch = [
if (radiobuttons.english.response == "Neither good nor bad" ||
radiobuttons.english.response == "Slightly good" ||
radiobuttons.english.response == "Moderately good" ||
radiobuttons.english.response == "Extremely good"
) survey.demo else surveypage.end
]
</survey>
<survey inst_cont>
/pages= [
1=inst2; 2=inst3; 3=inst4; 4=inst5]
/ finishlabel = "Yes, I agree to participate in this study."
</survey>
<expt>
/subjects = (1 of 2)
/groupassignment = groupnumber
/blocks = [
1= inst;
2= inst_cont;
3= demo;
4= rf_inst;
5= RegulatoryFocus;
6= demo3;
7= between;
8= pos_neg;
9= final;
]
/onexptend = [values.completed = 1]
</expt>
<surveypage english>
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/subcaptionfontstyle = ("Arial", 1.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3%, true, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2.5%, false, false, false, false, 5, 1)
/questions = [1 = english]
/showpagenumbers = false
/showquestionnumbers = false
/ showbackbutton = false
</surveypage>
<radiobuttons english>
/caption = "How would you describe your proficiency with the English language?"
/ options = ("Extremely bad", "Moderately bad", "Slightly bad",
"Neither good nor bad", "Slightly good", "Moderately good", "Extremely good")
/ optionvalues = ("1", "2", "3", "4", "5", "6", "7")
/required = true
/orientation = vertical
</radiobuttons>
Thank you so much for the prompt response!!
There are a number of things wrong with your code.
#1: You cannot /branch from a <survey> to a <surveypage>. A <survey> can only /branch to another <survey> (or <block>, since <survey> elements are special <block> elements).
<survey inst>
/pages=[1= inst1; 2= english]
/ branch = [
if (radiobuttons.english.response == "Neither good nor bad" ||
radiobuttons.english.response == "Slightly good" ||
radiobuttons.english.response == "Moderately good" ||
radiobuttons.english.response == "Extremely good"
) survey.demo else
surveypage.end]
</survey>
#2: People will get survey.demo regardless of what they answer because
you run it regardless.
- You have the /branch above under #1.
- You
additionally invoke survey.demo per your <expt>'s /blocks.
#3: If you have /optionvalues defined, the radiobuttons' response property returns the value you have defined in /optionvalues, not what's defined in /options.
Long story short, the proper way to do
show "inst1", then "english". If participants do not answer they know English, they should be redirected to an end page. If they check they know English, they should be directed to "survey.demo". Afterwards, they should see "inst_cont".
is this:
<values>
/ completed = 0
/ noenglish = 0
</values>
<survey inst>
/pages=[1= inst1; 2= english]
/ branch = [
if (radiobuttons.english.response <= 3)survey.end
]
</survey>
<survey demo>
/ pages = [1=demo1]
</survey>
<surveypage demo1>
/ caption = "demo1"
</surveypage>
<survey end>
/ pages = [1=end1]
</survey>
<surveypage end1>
/ ontrialend = [
values.noenglish = true;
]
/ caption = "This is the end."
</surveypage>
<survey inst_cont>
/pages= [
1=inst2; 2=inst3; 3=inst4; 4=inst5]
/ finishlabel = "Yes, I agree to participate in this study."
</survey>
<expt>
/ stop = [
values.noenglish == true;
]
/blocks = [
1= inst;
2= demo;
3= inst_cont;
]
/onexptend = [values.completed = 1]
</expt>
<surveypage inst1>
/ caption = "inst1"
</surveypage>
<surveypage inst2>
/ caption = "inst2"
</surveypage>
<surveypage inst3>
/ caption = "inst3"
</surveypage>
<surveypage inst4>
/ caption = "inst4"
</surveypage>
<surveypage inst5>
/ caption = "inst5"
</surveypage>
<surveypage english>
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/subcaptionfontstyle = ("Arial", 1.5%, false, false, false, false, 5, 1)
/itemfontstyle = ("Arial", 3%, true, false, false, false, 5, 1)
/responsefontstyle = ("Arial", 2.5%, false, false, false, false, 5, 1)
/questions = [1 = english]
/showpagenumbers = false
/showquestionnumbers = false
/ showbackbutton = false
</surveypage>
<radiobuttons english>
/caption = "How would you describe your proficiency with the English language?"
/ options = ("Extremely bad", "Moderately bad", "Slightly bad",
"Neither good nor bad", "Slightly good", "Moderately good", "Extremely good")
/ optionvalues = ("1", "2", "3", "4", "5", "6", "7")
/required = true
/orientation = vertical
</radiobuttons>