Howdy, Stranger!

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

Supported by

Text Input for free recall of multiple words

I am trying to design an experiment where the participants are first shown a list of words and after an interference task, are asked to enter all the words they can recall.
I have used the form_text_input for the free recall part of the experiment. However, I have two issues.
1) I want the participants to enter each word and then press the 'enter' key and then continue with the next word. If the return_accept is set to yes, then the form is terminated then and there. If I set it to no, then after pressing enter, nothing happens. I want to be able to enter multiple responses by pressing enter.
2) After the participant has typed all the words, I want him/her to press a button to exit the form. However, even if I disable the return_accept, only after I press enter, I am able to click the button. It is not activated till enter is pressed.

Comments

  • Hi,

    The first thing that comes to mind is simply to have three form_text_input items in a row, and have each of them accept the response on enter. Does that work, and if not, in what sense doesn't it?

    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,
    Thanks for responding. I did think about that. But the requirement of this particular experiment is that I give the participants 3 minutes to enter all the words they remember. The number of words will then vary from participant to participant. I cannot arrange a finite number of form_text_input can I? I also need the timeout of 3 minutes. Is that possible?
    So I basically want the participant to start entering the words they can remember and in case they are done before 3 minutes, they can simply press a button to proceed. If they continue to recollect and type, I want the form to end after 3 minutes. Please do let me know if there is any way for me to implement this.
    Thanks a lot

  • Hi Fawkes,

    I agree with Sebastiaan's suggestion. But I would implement it entirely in an inline_script with a while loop. In that inline_script you check how much time has passed since the loop was entered and whether participants pressed a certain exit key. If both are False, you open up a form and let participant type another word. Attached a script does should bring you most of the way.

    Good luck,
    Eduard

    Thanked by 1Fawkes
  • Hello Eduard,
    This worked perfectly. It was just as I needed. However, is there some way to automatically exit the loop after 3 minutes? Right now it exits only when I type in a word after 3 minutes have passed. This would be of great help. I'll be done with my experiment once this thing is sorted.

    Thanks again for the help,
    Fawkes

  • Yes!
    Just add timeout = <your timeout in milliseconds> to the creation of the form (prepare phase line 5).

    Eduard

  • Hi Eduard,
    The timeout option was already present in the script you shared. My issue is that the form has to close as soon as the specified time is up. However, it does not close. Only when I type in a word and hit the next button, it closes. The form is still open even after the time has passed. So in this case, the last word can be entered even after a long time and the form still accepts this last word before exiting. I hope you understood my issue.
    Thanks
    Fawkes

  • edited May 4

    Hi,

    No, it wasn't set.

    In the prepare phase, there should be this code:

    var.start_time = clock.time()
    timeout = 180000
    
    def resetForm():
        form = Form(
            cols=[1,1], rows=[1,2,1],
            margins=(50,100,50,100), spacing=25)
    
        text_input = TextInput(
                text=u'>>', frame=True, center=False, stub=u'Type here …',
                return_accepts=False, var=u'response',timeout = 2000) # THIS TIMEOUT KEYWORD IS NEW!
        button = Button(text=u'Next', frame=True, center=True, var=u'response')
        exitbutton = Button(text=u'Done', frame=True, center=True, var=u'exitButton')
    
        form.set_widget(exitbutton, (1, 2))
        form.set_widget(button, (0, 2))
        form.set_widget(text_input, (0, 0))
        return form
    
    

    Can you spot the difference? ;)

    Thanked by 1Fawkes
  • Hi Eduard,
    I added the keyword like you showed. There is an error message stating that 'timeout' is an unexpected keyword argument.
    Fawkes

  • edited May 4

    Oh, my bad.

    That was the wrong function, timeout has to be part of form initialization not widget creation.
    That code here should work.

    var.start_time = clock.time()
    timeout = 180000
    
    def resetForm():
        form = Form(
            cols=[1,1], rows=[1,2,1],
            margins=(50,100,50,100), spacing=25,timeout = 2000) # Here it goes
    
        text_input = TextInput(
                text=u'>>', frame=True, center=False, stub=u'Type here …',
                return_accepts=False, var=u'response') 
        button = Button(text=u'Next', frame=True, center=True, var=u'response')
        exitbutton = Button(text=u'Done', frame=True, center=True, var=u'exitButton')
    
        form.set_widget(exitbutton, (1, 2))
        form.set_widget(button, (0, 2))
        form.set_widget(text_input, (0, 0))
        return form
    
    Thanked by 1Fawkes
  • Yes!! It worked just like I wanted. Thanks a ton for all the help.

Sign In or Register to comment.