Reply To: Conditionals/display logic

PennController for IBEX Forums Support Conditionals/display logic Reply To: Conditionals/display logic

#9623
Jeremy
Keymaster

Hi Laia,

This line newVar("tag1").global().set(getScale("input_tag1")) will set the Var element to the last selected value, so you won’t exactly get what you want indeed: if the participant checks “oi” and later on also checks “fa”, then the Var element’s value will be “fa” and you won’t detect that “oi” is still checked

Because the Scale element only detects the most recent selection, you’ll need to use a workaround:

newTrial("pretest",
    newScale("input_tag1", "eh", "no", "oi", "fa") .checkbox().log().vertical().print(),
    newButton("go", "Endavant").print().wait(),
    newVar("tag1").global().set( ()=>document.querySelector("input[value='oi']").checked )
)

newTrial("exp",
    getVar("tag1").test.is(true).success(
        newText("instrus1", "You selected 'oi'!.") .print(),
        newButton("go", "Endavant") .print() .wait()
    )
)

Jeremy