help on ID information

PennController for IBEX Forums Support help on ID information

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #10487
    ElRk
    Participant

    Hello everyone,

    In the beginning of my experiment I have inserted a field where the participants have to type their name (ID) and then press a ‘Start’ button to continue with the experiment.
    For the moment, it is possible to press this ‘Start’ button without having typed something. Is it possible to change it so that it is necessary to type a name in order to press the button to move on?

    Demo link: https://farm.pcibex.net/r/MCDXhJ/

    Many thanks in advance,
    Eleni

    #10488
    Jeremy
    Keymaster

    Hello Eleni,

    Place a test inside the Button element’s wait command:

    newTextInput("ID", "").print()
    ,
    newButton("Start")
      .center()
      .print()
      .wait( getTextInput("ID").test.text(/\w/) )

    Jeremy

    #10498
    ElRk
    Participant

    Thanks a lot for your help Jeremy!

    #10517
    ElRk
    Participant

    I found out by accident that it works only if something is typed in english.
    If someone writes his/her name in greek (which is the experiment’s language) it’s not possible to press ‘Start’.
    Is there a way to change this?

    —————————————————————-

    newTextInput("ID")
          .print()
          ,
          newButton("Start")
          .print()
          .wait(getTextInput("ID").test.text(/\w/))
          ,
          newVar("ID")
          .settings.global()
          .set(getTextInput ("ID") )
          )
          .log ("ID" , getVar ("ID"));
    #10521
    Jeremy
    Keymaster

    Hi,

    My bad, the class \w will only capture ASCII based characters. Maybe use \S instead to capture any non-space character: .wait(getTextInput("ID").test.text(/\S/))

    Jeremy

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.