selectMultiple() Index Array Values When Attribute Options Added Or Deleted

I’m currently using the selectMultiple() form widget to select available page attribute options in a block like such:

echo $form->selectMultiple(‘filterSelectValues[’ . $akHandle . ‘]’, $akOptions, $values, array(‘id’ => ‘’, ‘size’ => $count, ‘style’ => ‘overflow: hidden;’));

$values being a zero indexed list of the positions in the list of the selected options. Works great until…

• select the third indexed attribute option in my block. Go to dashboard and remove the third option from the attribute. Now when my block does it’s thing. the option that WAS option 4, is now option 3 and displays that way, etc…

• Same applies if say, one was to add an option to a page attribute that is set to alpha ordering. That new option will end up in the middle somewhere and mess up the ordering for my block from that option down.

What I’d like to do is somehow cross reference the attribute values as opposed to just the zero index list, so at view time I can check the index against the original value and display properly. I’ve been pondering this for some time now and am not certain the best way to approach this. So, at the mercy of experience and suggestion it is :slight_smile:

I also understand there’s always the “click to add another field” option, but id rather cut the clicks to a minimum if possible, as someone with LOTS of selections to make will be forever in the edit dialogue if it must be done one at a time, with 300% clicks :expressionless: