ozgebakay

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Having participants select more than one option in questions #7426
    ozgebakay
    Participant

    Hi Jeremy,

    I am using the “checkbox” element, followed by a button. Is there a way to force the participants to choose at least one option before they can click on the button? With the code that I have, I display the button once they choose an option, but if they uncheck that option and have nothing checked, the botton will still be displayed and they can still click on the button and move on. Here is my code:

    newScale("answer", row.answer1, row.answer2, row.answer3)
        .checkbox()
        .print()
        .vertical()
        .log()
        .wait() // to make the participants choose at least one option before displaying the button
    ,
    newButton("Devam")
        .print()
        .wait()

    My second question is about the completion code. I have a confirmation code that is successfully displayed on the screen at the end of the experiment, but I cannot have it in my results file. Based on a previous question on this in the forum, I tried this, but it did not work:

    newTrial("end",
        newVar(randomnumber = Math.floor(Math.random()*1000000))
        ,
        newVar(completionCode = String("IST" + randomnumber))
        ,
        newVar(sendingResultsMessage = "...")
        ,
        newVar(completionMessage = "...: " + completionCode)
        ,
        newVar("completionMessage").global().set(getTextInput("completionMessage"))
    )
    .log("completionCode", completionCode)

    And the sequence of this experiment is as follows, in case it helps:
    Sequence("instructions", "intro", "practice1", "practice2", "practice3", "break", rshuffle("items", "fillers"), "increase", "SendResults()");

    Thank you,
    Özge

    ozgebakay
    Participant

    Thank you very much, Jeremy!

    I tried your example trial, it works! But I have two follow-up questions: I want to have a question before the list of options. Here is what I tried, but it did not work: Should the question be inside newScale? If so, how?

    newTrial("scale",
        newController("FlashSentence", {s : "Which one?"})
        ,
        
        newScale("answer", "Option1", "Option2", "Option3")
            .checkbox()
            .print()
        ,
        newButton("Next")
            .print()
            .wait()
    )

    My second question is: is there a way to list the options top to bottom rather than one next to the other on a single line?

    Thanks a lot,
    Özge

Viewing 2 posts - 1 through 2 (of 2 total)