Millisecond Forums

Pick one item out of multiple items in a survey page

https://www.millisecond.com/forums/Topic14534.aspx

By Jonathan Scheeff - 10/5/2014

Hi guys!

I am recently trying to generate a multiple choice survey for a study (using 5 pictures at a time where subjects should pick one of these). I altered the code from a survey example (the one with the baby cats and puppies).

A problem I can't solve myself is that I don't know how to tell Inqisit that they only can pick one option and not two ore more. Is the problem in the "surveypage" command? Would be great if you could help me out :-)

Cheers

Jonathan

Here is the code:

<expressions>
/ bagcount = checkboxes.aktetas40.checked.1 + checkboxes.damestas40.checked.1 + checkboxes.rugzak40.checked.1 + checkboxes.stoftas40.checked.1 + checkboxes.buiktas40.checked.1
</expressions>

<item selectedbags>
</item>


<checkboxes aktetas40>
/ options = ("1")
/ optionvalues = ("aktetas40.gif")
/ position = (25, 34)
/ required = false
</checkboxes>

<checkboxes damestas40>
/ options = ("2")
/ optionvalues = ("damestas40.gif")
/ position = (50, 34)
/ required = false
</checkboxes>

<checkboxes rugzak40>
/ options = ("3")
/ optionvalues = ("rugzak40.gif")
/ position = (75, 34)
/ required = false
</checkboxes>

<checkboxes stoftas40>
/ options = ("4")
/ optionvalues = ("stoftas40.gif")
/ position = (25, 59)
/ required = false
</checkboxes>

<checkboxes buiktas40>
/ options = ("5")
/ optionvalues = ("buiktas40.gif")
/ position = (50, 59)
/ required = false
</checkboxes>

<picture aktetas40>
/ items = bagoptions
/ position = (25, 23)
/ size = (20%, 20%)
/ select = 1
</picture>

<picture damestas40>
/ items = bagoptions
/ position = (50, 23)
/ size = (20%, 20%)
/ select = 2
</picture>

<picture rugzak40>
/ items = bagoptions
/ position = (75, 23)
/ size = (20%, 20%)
/ select = 3
</picture>

<picture stoftas40>
/ items = bagoptions
/ position = (25, 48)
/ size = (20%, 20%)
/ select = 4
</picture>

<picture buiktas40>
/ items = bagoptions
/ position = (50, 48)
/ size = (20%, 20%)
/ select = 5
</picture>

<item bagoptions>
/1 = "aktetas40.gif"
/2 = "damestas40.gif"
/3 = "rugzak40.gif"
/4 = "stoftas40.gif"
/5 = "buiktas40.gif"
</item>


<surveypage bagpage>
/ caption = "Je zal nu 1 tas stelen. Kies zorgvuldig 1 tas uit en steel ze door er op te klikken."
/ questions = [1=aktetas40; 2=damestas40; 3=rugzak40; 4=stoftas40; 5=buiktas40]
/ stimulusframes = [1=aktetas40, damestas40, rugzak40, stoftas40, buiktas40]
/ branch = [if (expressions.bagcount != 1) surveypage.bagpage; ]
/recorddata = true
</surveypage>

<survey bagselectionphase>
/ pages = [1=noreplace(bagpage)]
/ fontstyle = ("Verdana", -27, false, false, false, false, 5, 0)
/ itemfontstyle = ("Verdana", -16, false, false, false, false, 5, 0)
/ showpagenumbers = false
/ onblockend = [ if( checkboxes.aktetas40.checked.1 == true) item.selectedbags.item = checkboxes.aktetas40.optionvalue.1 ]
/ onblockend = [ if( checkboxes.damestas40.checked.1 == true) item.selectedbags.item = checkboxes.damestas40.optionvalue.1 ]
/ onblockend = [ if( checkboxes.rugzak40.checked.1 == true) item.selectedbags.item = checkboxes.rugzak40.optionvalue.1 ]
/ onblockend = [ if( checkboxes.stoftas40.checked.1 == true) item.selectedbags.item = checkboxes.stoftas40.optionvalue.1 ]
/ onblockend = [ if( checkboxes.buiktas40.checked.1 == true) item.selectedbags.item = checkboxes.buiktas40.optionvalue.1 ]
</survey>
By Dave - 10/5/2014

> A problem I can't solve myself is that I don't know how to tell Inqisit that they only can pick one option and not two ore more.
Your script already does that (as does the original). You count the number of checked elements here

</expressions>
/ bagcount = checkboxes.aktetas40.checked.1 + checkboxes.damestas40.checked.1 + checkboxes.rugzak40.checked.1 + checkboxes.stoftas40.checked.1 + checkboxes.buiktas40.checked.1
</expressions>

and run the page again if that count is not equal to one:

<surveypage bagpage>
/ caption = "Je zal nu 1 tas stelen. Kies zorgvuldig 1 tas uit en steel ze door er op te klikken."
/ questions = [1=aktetas40; 2=damestas40; 3=rugzak40; 4=stoftas40; 5=buiktas40]
/ stimulusframes = [1=aktetas40, damestas40, rugzak40, stoftas40, buiktas40]
/ branch = [if (expressions.bagcount != 1) surveypage.bagpage; ]
/recorddata = true
</surveypage>

Thus I'm not sure what the actual question or problem is...
By Jonathan Scheeff - 10/7/2014

Hi Dave!

Thanks for your reply. You are right, it works, but it would be smoother if subjects could always only pick one option. In this setting it is like you described: They can pick two options but return to the page until they picked one. So maybe it is not a problem and more a disfigurement. Do you have an idea how to do better?

Thanks in advance!

Jonathan
By Dave - 10/7/2014

> Do you have an idea how to do better?

Yes. Don't use a <surveypage> w/ <checkboxes> in this case. Simply set up a standard <trial> element that displays the pictures, have them click on the one they want to select:

<trial bagtrial>
/ stimulusframes = [1=aktetas40, damestas40, rugzak40, stoftas40, buiktas40, ...]
/ inputdevice = mouse
/ validresponse = (aktetas40, damestas40, rugzak40, stoftas40, buiktas40)
/ ontrialend = [ if (trial.bagtrial.response == "aktetas40") item.selectedbags.item = picture.aktetas40.currentitem]
....
/ ontrialend = [ if (trial.bagtrial.response == "buiktas40") item.selectedbags.item = picture.buiktas40.currentitem]
</trial>
By Jonathan Scheeff - 10/9/2014

Hi Dave!

Works perfect, thank you very much :-)

Cheers