PennController for IBEX › Forums › Support › Experiment freezes in the middle of trial sequence › Reply To: Experiment freezes in the middle of trial sequence
October 5, 2022 at 12:33 pm
#8665

Keymaster
Hi,
This is because the TextInput element gets deleted once the trial is over, and the .log
command on newTrial()
is executed asynchronously, so this command will fail when it so happens that it is executed after the trial is over: .log("answer", getTextInput("answer_box"))
Use a global Var element to make sure the element persists outside the trial and the log
command never crashes:
.wait( getTextInput("answer_box").testNot.text(""))
,
newVar("answer").global().set( getTextInput("answer_box") )
)
.log("code", row.code)
.log("context", row.context)
.log("answer", getVar("answer"))
)
Jeremy