PennController for IBEX › Forums › Support › Having participants select more than one option in questions
- This topic has 5 replies, 2 voices, and was last updated 3 years, 1 month ago by Jeremy.
-
AuthorPosts
-
October 4, 2021 at 7:47 pm #7346ozgebakayParticipant
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 BakayOctober 5, 2021 at 1:30 pm #7347JeremyKeymasterHi,
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
October 5, 2021 at 2:57 pm #7348ozgebakayParticipantThank 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,
ÖzgeOctober 5, 2021 at 3:05 pm #7349JeremyKeymasterIf 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-verticalJeremy
October 22, 2021 at 11:39 pm #7426ozgebakayParticipantHi 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,
ÖzgeOctober 25, 2021 at 12:31 pm #7430JeremyKeymasterHi Ö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
-
AuthorPosts
- You must be logged in to reply to this topic.