PennController for IBEX › Forums › Support › Output Text based on Selection in Dropdown Menu › Reply To: Output Text based on Selection in Dropdown Menu
July 8, 2020 at 11:57 am
#5777
Keymaster
Hi Andreas,
You’re mixing up plain javascript code and PennController code. The PennController test commands are meant to be used autonomously (ie. as a block of commands separated by commas, or inside a callback command for example, just like a newText command for example) not inside a javascript triconditional like this. You need to use success and/or failure so you can execute PennController commands conditionally. So this is what you second trial should look like:
newTrial("check",
newText("optionA").print(),
newText("optionB").print()
,
getVar("handedness").test.is("left")
.success( getText("optionA").text("Option1"),getText("optionB").text("Option3") )
.failure( getText("optionA").text("Option2"),getText("optionB").text("Option4") )
,
newButton("Next")
.print()
.wait()
)
Jeremy