Add a free format question to the same page as your checkbox select question. The free format needs a hidden, text variable named "_order." Give the free format this HTML:
<input name="[% QuestionName() %]_order" id="[% QuestionName() %]_order" type="hidden" value=""/>
<script>
function SSI_CustomGraphicalCheckbox(graphicalObj, inputObj, checked) {
var orderText = document.querySelectorAll('#[% QuestionName() %]_order')[0].value;
var order = [];
if (orderText) {
order = orderText.split(',').map(Number);
}
var item = -1;
var match = inputObj.id.match(/_([0-9]*)$/);
if (match) {
item = Number(match[1]);
}
if (checked) {
order.push(item);
}
else {
var index = order.indexOf(item);
order.splice(index, 1);
}
orderText = order.join(',');
document.querySelectorAll('#[% QuestionName() %]_order')[0].value = orderText;
}
</script>
Now create a constructed list whose parent list is the list used by the checkbox select question. Give this constructed list this code:
Begin Unverified Perl
my $plist = 'list1';
my $freeFormat = 'ff';
my $orderText = GETVALUE($freeFormat . '_order');
if ($orderText) {
my @order = split(',', $orderText);
foreach my $item (@order) {
ADD($plist, $item);
}
}
End Unverified
Line 2 should be updated with the name of the parent list. Line 3 should be updated with the name of the free format question.
Now you have a constructed list of the items selected by the respondent, in order of selection. You can use the Sawtooth Script function ListLabel to print out the first item selected.