Reply To: Exit button

PennController for IBEX Forums Support Exit button Reply To: Exit button

#6918
bgardner
Participant

Hi,

I’m trying to modify this to have a button that continues the experiment if they say yes to the consent form and stops the experiment if they say no. (Our online consent form is supposed to have the no option, not just assume they will just exit).

I have an attempt, but it doesn’t run. I think what I’m confused about is how to end the whole experiment, not just the trial.

newTrial("Consent",
    newHtml("Consent", "consent.html")
        .center()
        .print()
    ,
    newCanvas("consent_answers", '75vw', '80vh')
        .add("center at 50%", "middle at 25%", 
            newText("I have read this informed consent document and the material contained \
            in it has been explained to me verbally. All my questions have been answered, \
            and I freely and voluntarily choose to participate."))
        .add("center at 50%", "middle at 75%", 
            newScale("agree", "I want to participate in this study.", 
            "I do not wish to participate in this study.")
            .size("10em","auto")
            .button())
    ,
    newButton("stop", "Stop").callback(
        getCanvas("consent_answers")
            .print("center at 50vw", "middle at 50vh")
        ,
        getScale("agree").wait()
        ,
        getCanvas("consent_answers").remove()
        ,
        getScale("agree").test.selected("I do not wish to participate in this study")
            .success(
                clear()
                ,
                SendResults()
            )
        //exit the experiment if they say no, continue if they say yes
    )
    .print("right at 98vw","bottom at 98vh")
)