Howdy, Stranger!

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

Supported by

text_input fails

edited March 2020 in OSWeb

Good evening,

I'm attempting to create a date of birth field but each time I use the text_input widget, either using the OpenSesame code or Python it fails; either just not displaying or throwing the following error:

Uncaught ReferenceError: pixi is not defined, See the console for further details

This error above is thrown using the code created in the form_text_input item. E.g.

# Start
set timeout infinite
set spacing 10
set rows "1;1;6"
set only_render no
set margins "50;50;50;50"
set form_var response
set form_title Title
set form_question "Your question"
set description "A simple text input form"
set cols 1
set _theme gray
widget 0 0 1 1 label text="[form_title]"
widget 0 1 1 1 label center=no text="[form_question]"
widget 0 2 1 1 text_input focus=yes return_accepts=yes stub="" var="[form_var]"
# End


P.S. Is there a code tag I can use to format this?


Thanks

Comments

  • Hi Katana,

    The error message suggests that you're trying to run the experiment in OSWeb, which does not support form items. You can find an overview of supported functionality here:

    P.S. Is there a code tag I can use to format this?

    Yes, you can use the paragraph icon on the left of the text!

    Cheers,

    Sebastiaan

  • Cheers Sebastiaan - I'll give that a go now.

  • So OsWeb doesn't support form items so if I want to create a form that accepts a date of birth (month, date & year) what's the process? I dragged in a new inline_python_script and pasted in the code from this page https://osdoc.cogsci.nl/3.2/manual/forms/about/:

    # Create a form
    form = Form(
        cols=[1,1], rows=[1,2,1],
        margins=(50,100,50,100), spacing=25
    )
    # Create four widgets
    labelTitle = Label(text=u'Question')
    labelQuestion = Label(
        text=u'A bat and a baseball together cost $1.10. The bat costs one dollar more than the ball. How much does the ball cost?',
        center=False
    )
    button5cts = Button(text=u'$0.05')
    button10cts = Button(text=u'$0.10')
    
    # Add the widgets to the form. The position in the form is indicated as a
    # (column, row) tuple.
    form.set_widget(labelTitle, (0,0), colspan=2)
    form.set_widget(labelQuestion, (0,1), colspan=2)
    form.set_widget(button5cts, (0,2))
    form.set_widget(button10cts, (1,2))
    
    # Execute the form! In this case, the form will return the text of the button that
    # was clicked. This is one way to get a return value out of the form. Another way
    # is to use the 'var' keyword, supported some of the widgets.
    button_clicked = form._exec()
    

    So what am I doing wrong here? This just displays a blank screen.

  • So what am I doing wrong here? This just displays a blank screen.

    You're still using functionality that is not supported, in this case an inline_script .

    You cannot use forms in OSWeb, also not through scripting. However, in many cases you can emulate form-like behavior using a combination of a sketchpad and a mouse_response . Not very convenient, but possible!

Sign In or Register to comment.