Restricting responses to dropdown questions


Restricting responses to dropdown questions

Author
Message
mb194503
mb194503
Associate Member
Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)

Group: Forum Members
Posts: 4, Visits: 9
I 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
Dave
Dave
Supreme Being
Supreme Being (666K reputation)Supreme Being (666K reputation)Supreme Being (666K reputation)Supreme Being (666K reputation)Supreme Being (666K reputation)Supreme Being (666K reputation)Supreme Being (666K reputation)Supreme Being (666K reputation)Supreme Being (666K reputation)

Group: Administrators
Posts: 9.7K, Visits: 45K
mb194503 - Monday, April 15, 2019
I 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>

mb194503
mb194503
Associate Member
Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)Associate Member (92 reputation)

Group: Forum Members
Posts: 4, Visits: 9
Dave - Monday, April 15, 2019
mb194503 - Monday, April 15, 2019
I 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>

Thank you!! That worked! -MB
GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search