utkuturk

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Timeout in Filled Inputs with failure test #10729
    utkuturk
    Participant

    I have solved the problem by using a dummy timer from this thread: https://www.pcibex.net/forums/topic/controller-or-timer-conditional/

    I would be happy to know if there can be any improvement in this code.

    Here’s the solution:

    
    // Practice Trials
    Template("PracticePreambles.csv", (row) =>
      newTrial(
        "practice",
        newTimer(300).start().wait(), //white screen before the trial
        newText("Preamble", row.preamble)
          .center()
          .cssContainer({ "margin-right": "1em" })
          .print(),
        newTimer("hurry", 3000).start(),
        newTimer("dummy", 1)
          .callback(
            newTextInput("answer")
              .settings.before(getText("Preamble"))
              .log("validate")
              .lines(1)
              .cssContainer("display", "flex")
              .print()
              .wait(
                getTextInput("answer")
                  .test.text(/^(.{10,500})$/)
                  .failure(
                    newText("<b>Please write more.</b>")
                      .settings.color("red")
                      .print()
                  )
              ),
            getTimer("hurry").stop()
          )
          .start(),
        getTimer("hurry").wait()
        // add timelimit
      )
        .log("Preamble", row.preamble) // add these three columns to the results lines of these Template-based trials
        .log("Condition", row.condition)
        .log("ItemNumber", row.itemnum)
    );
    
Viewing 1 post (of 1 total)