PennController for IBEX › Forums › Support › html layout/event times/selector vs. scale/ compatibility › Reply To: html layout/event times/selector vs. scale/ compatibility
Hi,
newVar("correct1").global().set(getVar("answer1")).set( v=>v==row.Correct1 )
Does this write in answer1 the answer only if it matches the one in the template?
As you can see in your results file, the value of the Var element will be true
if what the user typed matches what you indicated in the CSV file, false
otherwise
If you want to condition your code on whether the participant typed the correct answer, just use test.is(true)
on the Var element and whatever you put in success
will run when they type the correct answer, otherwise what you put in failure
will run
Could you suggest how to improve the syntax?
You could simply do /^\S{1,6}$/
to accept any sequence of 1 to 6 non-space characters (which would then include diacritic characters, but also other non-space characters like _
or ?
for example)
Jeremy