Hi again,
I think I've figured out the problem I was having with blocking progress unless some specified range of choices in an mc_multiple item were selected. I thought I would share that here in case someone else bumps into the problem.
Desired behaviour: I want a block to engage if participants don't select within a range of choices for an mc_multiple question (say selecting 3 or 4 choices out of 7 options for the purpose of illustrating the issue)
First, I created a block item with the following code in the showif column: (mc_test.match(/,/g) || []).length < 2 || (mc_test.match(/,/g) || []).length > 3 //js_only
This should block progress if the value of the mc_multiple item (mc_test) contains fewer than 3 or greater than 4 selections (by counting the commas in the mc_test string).
Actual behaviour: This block engages when the participant chooses less than three or more than 4 choices, EXCEPT when only one choice is selected. In the case where only one choice is selected the block isn't engaging. This turns out to be because the value of the mc_multiple item is stored as a number when only one option is selected (rather than as a string when no options or > 1 options are selected).
Solution: So, in order to get the block to engage as desired the following code in the showif column of the block seems to work :
typeof mc_test ==="number" || (mc_test.match(/,/g) || []).length < 2 || (mc_test.match(/,/g) || []).length > 3 //js_only
I've attached a test survey just to show the behaviour I've described above. It includes a simple mc_multiple item with 7 choices and some blocks to illustrate.
Paul