Howdy, Stranger!

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

Supported by

"Back" button on forms

Hi!

I am creating a survey using multiple forms in OpenSesame, and would like to know if there is any way to add a "BACK" button. This would be useful if one participant realizes they made a mistake and would like to go back and select a different option.

Thank you!

Comments

  • Hi Paula,

    The short answer is no. Of course it would be possible to implement a back button using a script, but that would perhaps be more trouble than it's worth. You could consider using a form validator to prevent participants from advancing to the next form unless they've correctly filled out the current form. Would that be an alternative?

    Cheers!

    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Hi Sebastiaan,

    Thank you for the answer. As you suggest, I am trying to use the form validator as an alternative to having a "back" button.

    However, with this approach I am having difficulties inserting images in the forms (if I use the ready-made forms, then I am able to successfully insert images). I get the following error message:

    " widget.set_rect(self.get_rect(index))

    AttributeError: 'Image' object has no attribute 'set_rect' ".


    This is my code:

    >>def my_form_validator():

    >>return var.gender != u'no' 

    >>button_ok = Button(text=u'Next')

    >>label_gender= Label(u'Are you a boy or a girl?')

    >>checkbox_male = Checkbox(text=u'I am a boy', group=u'gender', var=u'gender')

    >>checkbox_female = Checkbox(text=u'I am a girl', group=u'gender', var=u'gender')

    >>image_kids = Image(path=pool['kids.png']) #yes, the image is in the file pool

    >>gender_form = Form(validator=my_form_validator, rows=[1,1,1,1], cols=[1,1])

    >>gender_form.set_widget(label_gender, (0,0), colspan=2)

    >>gender_form.set_widget(checkbox_male, (1,1))

    >>gender_form.set_widget(checkbox_female, (1,2))

    >>gender_form.set_widget(button_ok, (0,3), colspan=2)

    >>gender_form.set_widget(image_kids, (0,1), colspan=2, rowspan=2)

    >>gender_form._exec()


    Any advice you have will be greatly appreciated!


    Best,

    Paula

  • Hi Paula,

    The Image object is a sketchpad element. For forms you need to use the ImageWidget object. See also:

    Cheers,

    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Thank you very much! It works now!!

    Best,

    Paula

  • Hi together,

    I also need a back button in my experiment. I want to present a text which is very long. So I used two form_base items, one as page 1 and one for page two. Now my question is if there is an option that my participants can go back to page 1 (form_base 1) if they want to read the text again. I would be very grateful if anyone could help me or if there is any way to solve my problems.

    Thanks a lot,

    Sabrina

  • Hi Sabrina,

    A direct going-back-button is not implemented and not really possible in Opensesame. However, you might bypass the problem by restarting the first page upon clicking of a certain button. That approach is a bit hacky though and could have annoying consequences depending on your experimental structure. Basically, you have a button on your page 2 that will set a certain variable to True/False, depending on whether it is clicked. If you now put an inline_script right after the form item, in which you check whether the button was pressed, and if so, execute the entire form again. Does that make sense? One potential caveat could be that the responses that were already given might be lost.


    Let me know if you need help implementing this approach.

    Eduard

  • Hallo Eduard,

    thanks for your help. But I think I need help with the implementaion (inline_script). It is not importent that the answers are lost because it is only text that should be read again if necessary.

    And thank you in advance for your help.

    Sabrina

  • Hi Paula,


    This should give you a starting point for implementing your own back button. As long as you keep pressing back on the second form, you'll have to do both forms again. Once you hit anything other than back, the experiment continues.


    Good luck.

    Eduard


  • Thank you very much @eduard

Sign In or Register to comment.