[solved] Form rating scale question
Hi All,
I am trying to make a questionnaire using the form functions with four rating scale items and a "Next" button. I was wondering whether it was possible to make it so that the Next button would advance the program only if all the questions were answered on the screen.
Thanks for all your work on OpenSesame!
Comments
Hi Rob,
Sure, that's possible. You'll need a little bit of Python inline scripting for this. More specifically, you want to check whether none of the rating scale responses has the value 'None' (meaning no box was ticked). In order to use the rating_scale variable in an inline_script item, we use the experiment function
self.get(). The name of a given rating_scale variable depends on what value you gave to the 'var' keyword when you defined the rating_scale widget.For example, if you defined it as follows:
widget 1 1 1 1 rating_scale var="question1" nodes="Agree;Don't know;Disagree"the participant's answer is contained by the variable 'question1', which can be made available in an inline_script like so:
For more info about getting and setting variables, see:
The following inline script should give you an idea of how to do this in practice. Make sure you place the code in the Run phase tab of an inline_script that is appended to your trial sequence after the form_base item and before the logger item.
An example experiment can be downloaded here (save with the extension '.opensesame').
Does this help?
Best,
Lotje
Did you like my answer? Feel free to

This fixes the problem and clarifies a couple of other questions I had about the inline script items as well. I was a bit uncertain on what python code controlled whether a form advanced to the next item in the sequence, but this clears it up.
Thanks for all the help and the code!
Rob