Having participants select more than one option in questions

PennController for IBEX Forums Support Having participants select more than one option in questions

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7346
    ozgebakay
    Participant

    Hi,

    I need my participants to be able to select more than one option in answering the questions. Is there a way to do it in the current version of PCIbex? I read some entries about Scale here, but I am not sure if or how we can use it for that.

    Thanks a lot,
    Özge Bakay

    #7347
    Jeremy
    Keymaster

    Hi,

    There is a not-yet-documented command on Scale elements called checkbox which turns the options into checkoxes that can all independently be on/off. By default each option will appear as a label next to a checkbox, but you can use CSS rules to customize the rendering. For example, if you want to only keep the text labels and have a dotted frame appear around the selected options, you can add this to global_main.css:

    .PennController-Scale .option {
        margin: 1em;
    }
    .PennController-Scale .option input[type="checkbox"] {
        display: none;
    }
    .PennController-Scale .option input[type="checkbox"] + label {
        border: medium dotted transparent;
        padding: 0.25em;
    }
    .PennController-Scale .option input[type="checkbox"]:checked + label {
        border-color: black;
    }

    Example trial for reference:

    newTrial(
        newScale("answer", "hello", "world")
            .checkbox()
            .print()
        ,
        newButton("Hello world")
            .print()
            .wait()
    )

    Jeremy

    #7348
    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

    #7349
    Jeremy
    Keymaster

    If all you want to do is print a line of text, you should probably consider using a Text element (as in newText("Which one?").print())

    If you haven’t read the PCIbex tutorial yet, I invite you to do so, it’ll give you a general idea of how to do this kind of things: https://doc.pcibex.net/basic-tutorial/

    You can use the vertical command to display the options top-to-bottom: https://doc.pcibex.net/scale/#scale-vertical

    Jeremy

    #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

    #7430
    Jeremy
    Keymaster

    Hi Özge,

    1) You can get rid of the .wait() command on the Scale element, and replace the Button element’s .wait() command with: .wait( getScale("answer").test.selected() )

    2) You’re using the Var element in a non-standard way. I think what you want to do is:

    Sequence("instructions", "intro", "practice1", "practice2", "practice3", "break", rshuffle("items", "fillers"), "increase", SendResults())
    
    var sendingResultsMessage = "...";
    var randomnumber = Math.floor(Math.random()*1000000));
    var completionCode = String("IST" + randomnumber);
    var completionMessage = "...: " + completionCode;
    
    Header(
      // ...
    )
    .log("completionCode", completionCode)

    Jeremy

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