+xI am asking participants to rank order a set of four items through a series of dropdown boxes. Is there a way to create an error if someone ranks the same option twice? For example:
Rank 1: Item 1
Rank 2: Item 2
Rank 3: Item 1
Rank 4: Item 3
When the participant clicks to continue, this should throw an error message that the same Item was selected twice.
Thanks-MB
Yes, this is perfectly possible.
<block myblock>
/ trials = [1=rankpage]
</block>
<values>
/ rankstring = ""
</values>
<surveypage rankpage>
/ ontrialbegin = [values.rankstring = "";]
/ questions = [1=r1; 2=r2; 3=r3; 4=r4]
/ ontrialend = [values.rankstring = concat(values.rankstring, dropdown.r1.response);
values.rankstring = concat(values.rankstring, dropdown.r2.response);
values.rankstring = concat(values.rankstring, dropdown.r3.response);
values.rankstring = concat(values.rankstring, dropdown.r4.response);
]
/ branch = [if (!contains(values.rankstring, "1") || !contains(values.rankstring, "2") || !contains(values.rankstring, "3") || !contains(values.rankstring, "4")) surveypage.errorpage]
</surveypage>
<surveypage errorpage>
/ caption = "You ranked at least one item multiple times. Please try again."
/ branch = [surveypage.rankpage]
</surveypage>
<dropdown r1>
/ caption = "Rank 1"
/ options = ("Item 1", "Item 2", "Item 3", "Item 4")
/ optionvalues = ("1", "2", "3", "4")
</dropdown>
<dropdown r2>
/ caption = "Rank 2"
/ options = ("Item 1", "Item 2", "Item 3", "Item 4")
/ optionvalues = ("1", "2", "3", "4")
</dropdown>
<dropdown r3>
/ caption = "Rank 3"
/ options = ("Item 1", "Item 2", "Item 3", "Item 4")
/ optionvalues = ("1", "2", "3", "4")
</dropdown>
<dropdown r4>
/ caption = "Rank 4"
/ options = ("Item 1", "Item 2", "Item 3", "Item 4")
/ optionvalues = ("1", "2", "3", "4")
</dropdown>