Reply To: Enabling a button after text is entered without pressing Enter

PennController for IBEX Forums Support Enabling a button after text is entered without pressing Enter Reply To: Enabling a button after text is entered without pressing Enter

#6158
Jeremy
Keymaster

Hi,

Since there is no checkbox element natively implemented in PennController yet, you’ll need to code the checkbox element yourself, for example as part of an HTML document. Make sure you give it a unique ID or class, and use the method above. Here’s an example:

newTrial(
    newHtml("form", `<div>
    <input name='consent' id='consent' type='checkbox'><label for='consent'>I consent</label>
    </div>`).print()
    ,
    newFunction( () => $("#consent").change( e=>{
        if (e.target.checked) getButton("Next").enable()._runPromises();
        else getButton("Next").disable()._runPromises();
    }) ).call()
    ,
    newButton("Next")
        .disable()
        .print()
        .wait()
)

Jeremy