Hi,
to come back to your first idea.
All questions set to "mandatory" (either you select some rice or "no rice")
And inserted the script to have this "no rice" option always at the end
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// The number of answers to be fixed at the end of the list
var fixedAnswers = 1;
// Set this to "true" if you want "Other" to be fixed in the last position
var otherFixed = false;
// Identify this question
var qID = {QID};
// Find the number of answers
var ansCount = $('#question'+qID+' .answer-item').length;
if($('#question'+qID+' input[type="text"]').length > 0) {
ansCount = ansCount -1
}
console.log(ansCount);
// Place the last n answers created at the end of the list
var fixedIndex = fixedAnswers - 1;
for (var i=0; i<fixedAnswers; i++) {
var answer = $('input[id^="answer"][id$="X'+qID+(ansCount-fixedIndex)+'"]');
var answerItem = $(answer).closest('.answer-item');
var answersList = $(answer).closest('ul');
$(answersList).append(answerItem);
fixedIndex--;
}
// Handle "Other"
if(otherFixed == true && $('#question'+qID+' input[type="text"]').length > 0) {
var otherAnswer = $('#question'+qID+' input[type="text"]');
var otherAnswerItem = $(otherAnswer ).closest('.answer-item');
var otherAnswersList = $(otherAnswer ).closest('ul');
$(otherAnswersList).append(otherAnswerItem);
}
});
</script>
Furthermore you may randomize the categories with "randomization group name"
Then you can do this at the end:
count the numbers of "no protein", "no rice", ... (cntNo)
{sum(if(C4A.NAOK==7,1,0),if(C4B.NAOK==7,1,0),if(C4C.NAOK==5,1,0),if(C4D_9=="Y",1,0),if(C4E.NAOK==6,1,0),if(C4F_7=="Y",1,0))}
count the numbers of categories with selected options (cntCat)
{sum(if(!is_empty(C4A),1,0),if(!is_empty(C4B),1,0),if(!is_empty(C4C),1,0),if(count(that.C4D)>0,1,0),if(!is_empty(C4E),1,0),if(count(that.C4F)>0,1,0))}
Now you can display at the end
either (if cntNo==6)
or (if cntCat==6)
But anyway, your requirement is fulfilled.
Joffm