Conditional Assent/Consent Page

PennController for IBEX Forums Support Conditional Assent/Consent Page

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8317
    Rebecca
    Participant

    Hi, 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"))
        ));
    #8318
    Jeremy
    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

    #8319
    Rebecca
    Participant

    Thank you so much for your help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.