PennController for IBEX › Forums › Support › Force response? › Reply To: Force response?
April 14, 2020 at 8:12 pm
#5042
Jeremy
Keymaster
Hi,
Sure, adding an error message is actually pretty easy:
newText("emptyinput", "Please type your answer in the field above").color("red").bold() , getTextInput("inputanswer") .wait( // Using a regular expression here: at least one non-empty character getTextInput("inputanswer").test.text(/[^\s]/) .failure( getText("emptyinput").print() ) ) , getText("emptyinput").remove()
There currently is no straightforward way to check your participants’ devices, but you can inject some javascript using the Function element. This page for example describes one method, we could incorporate it into pcibex like this:
newTrial( newFunction( () => navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i) ) .testNot.is(null) .success( newText("We are sorry but this experiment was not designed for mobile devices. Please try again with a non-mobile device. Thank you.").print() , newTimer(1).wait() ) , newButton("Start the experiment").print().wait() )
Note that this is definitely not 100% reliable, but any tech-savvy enough person who wants to fool your experiment will be able to anwyay
Also note that some platforms, like Prolific, do not accept this kind of filtering after your participants have enrolled for your experiment on the platform
Jeremy