[open] Form - enter button
I'm trying to create a form in open sesame that is a question with three answer boxes. using the code bellow, to get from the first box to the second you have to press enter, then click the second box, type your response, press enter, click on the third box, type your answer, press enter, click next to move onto the next page. there is also a submit button, and if i make the accepts="yes" rather than no, pressing enter on that response moves onto the next page, which would be fine for the third question, but doesn't allow subjects to respond to the first two questions. we need to know the total time that the subject spends to answer all three questions
Ideally, I'd want to let subjects be able to move to the next box by clicking the tab button, or just having access to their mouse, because the enter then click thing is really annoying. Let me know if this is possible!
set margins "50;100;50;100"
set rows "1;1;1;1;1"
set spacing "20"
set cols "1;1;1"
set description "A generic form plug-in"
widget 0 0 3 1 label center="no" text="What were the [Target_Color] words?"
widget 0 1 1 1 text_input return_accepts="no" var="Word_01_Response"
widget 0 2 1 1 text_input return_accepts="no" var="Word_02_Response"
widget 0 3 1 1 text_input return_accepts="no" var="Word_03_Response"
widget 2 4 1 1 button text="Next"
Comments
ITA
We will come back to you as soon as possible!
Did you like my answer? Feel free to
![:) :)](https://forum.cogsci.nl/plugins/emojiextender/emoji/twitter/smile.png)
Hi,
Sorry for the delay.
There is a trick to use this keyword argument to obtain the desired behaviour, namely a form in which the participant can go to the next box without having to make any mouse clicks.
This works as follows. Instead of creating one form_base item, we wrap a loop item around three form_base items with a slightly OpenSesame script. (Still, for the participant this will look as one form.)
More specifically:
Firstly, create an experiment with an overview that looks something like this:
Secondly, enter the following scripts into the three form_base items (please see the comments for further explanation).
form_base1: For the first text_input widget, set focus to 'yes', and set return_accepts to 'yes'. focus = 'yes' indicates that the participant can start typing in this box immediately (without having to click in it first). Don't specify anything yet for the other widgets yet (just draw them).
form_base2: For the second form_base, set focus and return_accepts to "yes" for the second text_input widget. For the first text_input widget, set the text to "Word_01_Response" (to keep the previously-given response on screen).
form_base3: For the last form_base item, fill both previous text input widgets with the given responses and set focus and return_accepts to 'yes' for the last item.
I uploaded a working example experiment here (download, change the extension from '.txt' into '.opensesame' and open as normally).
I hope this helps! If you have any more questions, don't hesitate to ask them!
Best,
Lotje
Did you like my answer? Feel free to
![:) :)](https://forum.cogsci.nl/plugins/emojiextender/emoji/twitter/smile.png)
Hi Lotje,
Thanks so much for your help, it is so much better now! One question I can't figure out now is whether or not I can disable the tab function. As it is now, when participants press tab to go to the next box rather than return, the mouse appears and it is very hard to advance to the next page. It seems to work if I click on the first box and retype their answers, but if there is a way to just disable mouse/tab options completely that would be much easier.
Thanks!
Margaret
Sorry for the wait, I'll get back to you soon. ITA
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Margaret,
The fact that pressing Tab defocuses a widget is built-in to the forms. The easiest way to nevertheless get the behavior that you need is probably to take control of the form widgets more directly. The script below implements the form described above in Python inline script.
Essentially, the script doesn't run the form as a whole, but selectively activates the three
text_input
widgets. Normally, a form would show a mouse when you press Tab while in atext_input
, but the script shown below will simply advance to the next widget when Tab is pressed. The script is explained in more detail in the code comments.This approach is more complicated than using the
form_base
plug-in, but it offers more flexibility. Also, it allows you to pack the whole form into one script, insteed of three separate items.For more information, see also:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!