Howdy, Stranger!

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

Supported by

Button only visible when rating scales are filled in

Hello guys,

again I need help with my inline script code.

I have created a form with 4 rating scales on it. When all 4 rating scales are filled in, a 'Next' button has to appear.
When one of these rating scales are not filled in, there should be no possibility to move on to the next page.

How is it possible to check if all 4 rating scales are filled in on an event base(mouse click) and then to make the button visible while the form is presented? It is not an option to reload the whole form because of some randomization I have to do on it.

Thanks for your ideas and input :)

Comments

  • edited February 2017

    Ok I got it myself :smiley:
    For anyone with the same problem as me, here is my solution:
    Execute the form
    "while True" loop
    if one of the response variables you get from the rating scales are empty execute the form again
    else break the loop

    Here is the python code for an inline script:

    form = widgets.form(self.experiment, cols=[1,1,1,1,1,1], rows=[3,1,3,1,1], margins=(10,10,10,10))
    button = widgets.button(form, text='Next')
    form.set_widget(button, (4,4), colspan=1)
    form._exec()
    while True:
        if var.response1 == None or var.response2 == None or var.response3 == None or var.response4 == None:
            form._exec()
        else:
            break
    
Sign In or Register to comment.