How to sort Checkbox Entries

Hi there,

I have a lot of Checkbox fields in my Blueprint (more then 100). All is working fine and as expected, but now I have the problem that when I echo them, the order depends on which checkbox was marked last.

For example: If I check all entries, expect of the first and save, the order fits. But then, when I check the first entry and echo all, the first entry is at the last position. Is there any workaround for this?

The easiest way would probably be to override the checkboxes field and make sure the options are stored in the order they appear, not the oder in which they are selected. I assume new options are always just appended to what is already stored in the field.

What sort of sorting order logic do these options have?

Exactly that’s the problem. They are appended to the saved ones … I have a huge List of possible Products that can fit, but I must always output the same order. The order ist defined by the customer

Do these checkboxes then always contain the same options in the same order?


Then you could create an array of all these options to determine the correct order and then order the selected options by the order from that array.

Puhhh, ok! No idea how to solve this in PHP but I will give a try^^

$options = ['a', 'b', 'c', 'd'];
$selected = ['c', 'd',  'a'];
$intersection = array_intersect($options, $selected);


Wrap the logic into a field method.

1 Like