PennController for IBEX › Forums › Support › Conditional Assent/Consent Page › Reply To: Conditional Assent/Consent Page
		August 1, 2022 at 10:22 am
		
		#8318
		
		
		
	
Keymaster
		
		
	Hi,
The two newTrial commands in your code are embedded inside a PennController command — PennController() is the older name of newTrial(), so you’re effectively passing PennController trials as arguments to another PennController trial, which won’t work
Here 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