PennController for IBEX › Forums › Support › Conditional Assent/Consent Page
- This topic has 2 replies, 2 voices, and was last updated 2 years, 1 month ago by
Rebecca.
-
AuthorPosts
-
July 29, 2022 at 3:50 pm #8317
Rebecca
ParticipantHi, I’m trying to develop an experiment and I need to show either a consent or assent page, depending on whether the participant is over or under 18, respectively. From there, the experiment should proceed in the same way regardless of whether the participant saw the assent/consent page. I have the following code, but when I add “age” into my overall experiment sequence, it just skips over this section entirely. Is there a way to do what I described above? Thanks!
PennController("age" , newHtml("consent", "Consent-Online.html") , newTrial("consent", getHtml("consent" .print() , newText("<br/>") , newText("<br/>") , newButton("By clicking this button I indicate my consent") .print() .wait() ) ) , newHtml("assent", "Assent-Online.html") , newTrial("assent", getHtml("assent" .print() , newText("<br/>") , newText("<br/>") , newButton("By clicking this button I indicate my assent") .print() .wait() ) ) , newText("age", "Are you 18 years of age or older? <br/><br/>") , newButton("yes", "Yes, I am 18 years old or older.") , newButton("no", "No, I am under 18 years old.") , getText("age") .print() , getButton("yes") .print() .test.clicked() .success(jump("consent")) , getButton("no") .print() .test.clicked() .success(jump("assent")) ));
August 1, 2022 at 10:22 am #8318Jeremy
KeymasterHi,
The two
newTrial
commands in your code are embedded inside aPennController
command —PennController()
is the older name ofnewTrial()
, so you’re effectively passing PennController trials as arguments to another PennController trial, which won’t workHere is what you can do instead:
newTrial("age" , newVar("over18", false).global() , newText("age", "<p>Are you 18 years of age or older?</p>").print() , newButton("yes", "Yes, I am 18 years old or older.").print() , newButton("no", "No, I am under 18 years old.").print() , newSelector("yesno") .add( getButton("yes") , getButton("no") ) .wait() .test.selected( getButton("yes") ) .success( getVar("over18").set(true) ) ) newTrial( "*sent" , getVar("over18").test.is(true).success( newHtml("consent", "Consent-Online.html").css("margin-bottom", "2em").print() , newButton("By clicking this button I indicate my consent") .print() .wait() ).failure( newHtml("assent", "Assent-Online.html").css("margin-bottom", "2em").print() , newButton("By clicking this button I indicate my assent") .print() .wait() ) )
Jeremy
August 1, 2022 at 5:17 pm #8319Rebecca
ParticipantThank you so much for your help!
-
AuthorPosts
- You must be logged in to reply to this topic.