Millisecond Forums

checkboxes correct responses and data

https://forums.millisecond.com/Topic25529.aspx

By jm560@sussex.ac.uk - 9/16/2018

Hi,

I'm having trouble using checkboxes. I want to display a list of options from which participants can select up to six - but only two are correct. It works correctly until I add 'correctresponse' which makes the question stay red and doesn't allow me to answer the question. Script below - 

<survey memorytest>
/ pages = [1 = p1]
</survey>

<surveypage p1>
/ questions = [1 = q1]
/ showquestionnumbers = false
</surveypage>

<checkboxes q1>
/ caption = "Please choose a maximum of six options you saw previously in the experiment:"
/ options = ("Cadbury", "Twix", "Wrong", "Wrong", "Wrong", "Wrong", "Wrong", "Wrong")
/ range = (1,6)
/ order = random
/ correctresponse = ("Cadbury", "Twix")
</checkboxes>

What is the issue here? Also is there a way of including number or correct answers in my summary data - I don't care which ones they got right (cadbury or twix), only how many.

Thanks,
Jenny

By Dave - 9/16/2018

jm560@sussex.ac.uk - Monday, September 17, 2018
Hi,

I'm having trouble using checkboxes. I want to display a list of options from which participants can select up to six - but only two are correct. It works correctly until I add 'correctresponse' which makes the question stay red and doesn't allow me to answer the question. Script below - 

<survey memorytest>
/ pages = [1 = p1]
</survey>

<surveypage p1>
/ questions = [1 = q1]
/ showquestionnumbers = false
</surveypage>

<checkboxes q1>
/ caption = "Please choose a maximum of six options you saw previously in the experiment:"
/ options = ("Cadbury", "Twix", "Wrong", "Wrong", "Wrong", "Wrong", "Wrong", "Wrong")
/ range = (1,6)
/ order = random
/ correctresponse = ("Cadbury", "Twix")
</checkboxes>

What is the issue here? Also is there a way of including number or correct answers in my summary data - I don't care which ones they got right (cadbury or twix), only how many.

Thanks,
Jenny


You cannot use /correctresponse for that. Instead, you'll need to use some /ontrialend logic on the <surveypage> hosting the checkbox question to evaluate the response (check for correctness of the selected options, count the number of correctly selected options). One useful thing to do in addition is to use /optionvalues, you could encode the correct options as "1" and all the wrong ones as "0", which will make the counting easier. Finally, you'll want to store the information of interest in <values> and log those to your summary data file as needed. Something like this:

<survey memorytest>
/ pages = [1 = p1]
</survey>

<surveypage p1>
/ ontrialend = [
    values.nchecked = checkboxes.q1.checked.1 + checkboxes.q1.checked.2 + checkboxes.q1.checked.3 + checkboxes.q1.checked.4 + checkboxes.q1.checked.5 + checkboxes.q1.checked.6 + checkboxes.q1.checked.7 + checkboxes.q1.checked.8;
]
/ ontrialend = [
    values.ncorrect = length(checkboxes.q1.response) - length(replaceall(checkboxes.q1.response, "1", ""));
]
/ questions = [1 = q1]
/ showquestionnumbers = false
</surveypage>

<checkboxes q1>
/ caption = "Please choose a maximum of six options you saw previously in the experiment:"
/ options = ("Cadbury", "Twix", "X1", "X2", "X3", "X4", "X5", "X6")
/ optionvalues = ("1", "1", "0", "0", "0", "0", "0", "0")
/ range = (1,6)
/ order = random
</checkboxes>

<values>
/ ncorrect = 0
/ nchecked = 0
</values>

<summarydata>
/ columns = (script.startdate, script.starttime, script.subjectid, script.groupid
    values.nchecked, values.ncorrect)
</summarydata>