April 8, 2020 at 12:44 pm #5025elif_cornellParticipant
Hi- I am trying set up my trials so that in each trial, an image appears and below the image, there are multiple rating scales. I want to randomize the order of the rating scales. In the code below, I created to scales for two dimensions (active and exciting).
.after( newText(“active_label”, ” active”) )
.after( newText(“exciting_label”, ” exciting”) )
.add( getScale(“active_scale”), getScale(“exciting_scale”) )
Currently when I run it, the experiment ends after I make a selection using the first scale. What is a way to fix this? Or is there another way to randomize the order or rating scales appearing on the same page?
Thanks a lot!April 8, 2020 at 12:50 pm #5026JeremyKeymaster
Your use of the Selector element to shuffle the Scale elements is on the right track, but then calling .wait on that Selector means that you want your participant to simply click on one of the two scales. You should probably replace that .wait() command with .disable() to turn your Selector into a dummy element (you just use it to shuffle the Scales) and add a Validation button at the end where you check that both scales have an option selected, like this:
newButton("Validate") .print() .wait( getScale("active_scale").test.selected().and(getScale("exciting_scale").test.selected()) )
JeremyApril 8, 2020 at 2:06 pm #5028elif_cornellParticipant
Thanks a lot! Now I can use the both of the rating scales; however, the order of the scales is not randomized. I think what is happening is that the scales themselves are actually shuffled, but the texts next to the scale (active and exciting) stay the same. I can’t figure out a way to shuffle the scale and its label together. Any ideas on this?April 8, 2020 at 2:27 pm #5029JeremyKeymaster
Right, sorry, I hadn’t anticipated the Text elements not being randomized along with their respective Scale elements
The reason why the after and before contents don’t get carried along is because the shuffled elements could actually themselves be in an after/before relationship (as in the example on the documentation page).
At this point the only solution I see is to create Canvas elements that contain your Scale+Text elements, like this:
newCanvas("active_scale_container", "auto", "1.5em").print(), newScale("active_scale", 7) .after( newText("active_label", " active") ) .slider() .print(0,0,getCanvas("active_scale_container")) , newCanvas("exciting_scale_container", "auto" , "1.5em").print(), newScale("exciting_scale", 7) .after( newText("exciting_label", " exciting") ) .slider() .print(0,0,getCanvas("exciting_scale_container")) , newSelector() .add( getCanvas("active_scale_container"), getCanvas("exciting_scale_container") ) .shuffle() .disable()
Unfortunately you have to specify an arbitrary height, because of the CSS rules that PennController applies to Canvas elements, but 1.5em sounds like a reasonable height.
- You must be logged in to reply to this topic.