How to deactivate the "next" button when all checkboxes are unchecked
Hi there,
I need your help about a problem, maybe it's not difficult to solve, but I'm a beginner in OpenSesame. I need participants to respond in a checkbox page, and if a participant doesn't choose any checkbox, he/she could not next to the other screen. There are 4 photos and 4 checkboxes, and the participant has to choose only one of them before proceeding. I couldn't deactivate the next button, so it's proceeding when the participant clicks the next button without any choice. The script of form_base is below.
Thank you in advance!
set timeout infinite
set spacing 10
set rows "1;1;1;1;1"
set only_render no
set margins "20;10;10;20"
set form_var response
set description "A generic form plug-in"
set cols "1;1;1;1;1"
set _theme gray
widget 2 0 1 1 label center=yes text="[verb1]"
widget 1 1 1 2 image path="f1.jpg"
widget 2 1 1 2 image path="f2.jpg"
widget 3 1 1 2 image path="f3.jpg"
widget 4 1 1 2 image path="f4.jpg"
widget 1 3 1 1 checkbox click_accepts=no group=response text=1 var=check
widget 2 3 1 1 checkbox click_accepts=no group=response text=2 var=check
widget 3 3 1 1 checkbox click_accepts=no group=response text=3 var=check
widget 4 3 1 1 checkbox click_accepts=no group=response text=4 var=check
widget 2 4 1 1 button center=yes frame=yes text=next
Comments
Hi Solak,
There are a few ways in which you could do this.
The easiest way is to group the add the four checkboxes to a group (which you've already done), and then set
click_accepts=yes
. Then you can remove the button altogether, so participants have to check one box to advance.A more advanced way is by using form validation, as described here. That would require some minor inline scripting though. The snippet below should get you started.
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!