Reply To: Randomizing the order of rating scales appearing on the same page

PennController for IBEX Forums Support Randomizing the order of rating scales appearing on the same page Reply To: Randomizing the order of rating scales appearing on the same page

#5029
Jeremy
Keymaster

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.

Jeremy