Reply To: Several questions about the TextInput element

PennController for IBEX Forums Support Several questions about the TextInput element Reply To: Several questions about the TextInput element

#6331
Jeremy
Keymaster

Hello Matthias,

As I mentioned in point 2, you can retrieve the value of an HTML field and store it in a Var element, which means you can use log to append the value at the end of the results lines. Here’s a full example:

newTrial(
    newVar("Alter").global()
    ,
    newHtml("alter", "<input type='number' id='alter' name='alter' min='1' max='120'>").print()
    ,
    newButton("Next").print().wait( 
        getVar("Alter").set( v=>$("#alter").val() ).testNot.is('')
    )
)
.log("alter", getVar("Alter"))

Re. point 4, what you describe seems similar to using .log('all') except that it would be less reliable (eg. the first printable keypress could correspond to an uncaptured diacritic character, or the participant could press a key outside the input field that would then be wrongly detected). Is there something that dissuades you from using the .log('all') solution?

Jeremy