Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Dependent Multiple Choice questions

Hello,

I'm currently setting up a questionnaire in OpenSesame. It contains some Multiple Choice questions that are dependent from each other in the following sense:

I have a question “1”. Possible answers are "a", "b", "c", "d". Now if the subject selects "a", the experiment continues with question 2. If the subject selects answers "b", "c" or "d", then a question 1b must be answered.

A picture of the sequence to make it more clear:

I tried to solve this problem with inline scripts the following way: I made an overall sequence which contains many sequences. Those all contain a single inline script with either a question 1, 2, 3, etc. or a question 1, 2, 3 AND a question 1b, 2b, 3b, etc. These "b-items" are only presented when the previous question was answered with “b”, “c”, or “d”. So far, so good. The problem I have now is that the question that has been answered already is displayed completely new (the subject has to answer it again, first answer is overwritten). What I would like to have is that the participant’s answer to the first question (the one which he already answered and led to the display of the “b”-question) is already selected on the page where the “b”-question appears. So that it looks as if it wasn't a new page but the "b-item" is displayed on the same page additionally.

This is the code I am using in the "b-items":

def form_validator(): 
        options = [0,1,2,3]
        return var.q01b in options
 
title = Label(text=u'title')
 
q1 = Label(text=u'question1', center=False)
q2 = Label(text=u'question1b', center=False)
 
ratingScale1 = RatingScale(
        var=u'q01',
        nodes=[u'a', u'b', u'c', u'd']
)
ratingScale2 = RatingScale(
        var=u'q01b',
        nodes=[u'a', u'b', u'c', u'd']
)
 
nextButton = Button(text=u'Weiter')
 
 
form = Form(validator=form_validator, rows=[1,1,1,1], cols=[4,7], margins=(10,40,10,40), spacing=25) 
form.set_widget(title, (0, 0), colspan=2)
form.set_widget(q1, (0, 1)) 
form.set_widget(ratingScale1, (1, 1))
form.set_widget(q2, (0, 2)) 
form.set_widget(ratingScale2, (1, 2))
form.set_widget(nextButton, (0, 3), colspan=2)
form._exec()

Is there any solution to this problem? Thank you in advance,

Nicole

Comments

  • Hi Nicole,

    I think the easiest solution is to abandon the sequence structure and have all the elements within a single inline_script (that is within a single trial, across trials you can still use an inline_script)

    Like you already do, prepare all the questions in advance, but on separate forms and execute the first one, once a response has been given check the answer and if the variable is '0' move on to question 2, if not, go on to question 1b. This should keep it simple, but still implements the functionality you want.

    By the way, I don't think you need a form validator.

    Does that make sense, or do I misunderstand you?

    Eduard

  • Hi Eduard

    Thank you for your fast reply! This is what I did first but it is rather important to us that the first and the "b-item" are displayed on the same page.

    I also tried to put the first and the "b-item" into the same inline script but it didn't work beacause of the following reason: I can only check whether the b-item should be displayed after the first item was executed and the participants chose their answer. Afterwards I would have to set up a new form, which would lead to the same problem as described above.

    I need the form validator since we want to prevent people from clicking the next button without answering a question. Or did I miss something there?

    Regards,

    Nicole

  • Hi Nicole,

    I can only check whether the b-item should be displayed after the first item was executed and the participants chose their answer.

    In this case, you are right. You will need to first execute one form without the b-item, once the participant responds the "right" thing, you make the same form again, but add the b field to it, and show it. I think you know how to add that, right? I also think you can set the default option that is shown (the "default" argument?) to the response that triggered the B-item.

    I need the form validator since we want to prevent people from clicking the next button without answering a question.

    Oh, okay, yeah that makes sense maybe.


    Eduard

  • Hey Eduard

    The default option was exactly what I was looking for!

    Thank you for your help.

    Regards,

    Nicole

Sign In or Register to comment.