Reply To: html layout/event times/selector vs. scale/ compatibility

PennController for IBEX Forums Support html layout/event times/selector vs. scale/ compatibility Reply To: html layout/event times/selector vs. scale/ compatibility

#7993
Jeremy
Keymaster

Hi,

Can I impose a restriction on the blanks so that the participant cannot leave it empty, as well as a restriction that the participant cannot write something 20 characters long, I don’t know..to impose a range that the string the participant writes is between 1 and 6 characters long.

You could replace the ‘continue’ link of the Form controller with a Button element, and test the content of the Var elements in its wait command:

newController("Form", blank("It was so ea__ to get lost in an anc__ buil____")).print()
,
newButton("Continue").print().wait(
    getVar("answer1").test.is(v=>v.match(/^\w{1,6}$/))
        .and( getVar("answer2").test.is(v=>v.match(/^\w{1,6}$/)) )
        .and( getVar("answer3").test.is(v=>v.match(/^\w{1,6}$/)) )
        .failure( newText("Please type between 1-6 characters in each box").print() )
)

Just make sure you set continueMessage: null on the Form controller, either as a default, or by modifying the first line of blank:

blank = sentence => Object({continueMessage: null, html: 

Jeremy