Listbox-multiple issue re "preserveSelectionOrder"

This issue has recently arisen with MODX 3.1.2 running on PHP 8.3 and relates to the TV Listbox (Multiselect) which does not appear to maintain its settings in the manager but appears on the front end but eventually does disappear on the front end. The latter could be caching.

Having checked the error logs I can see this error message and assume it is connected.

core/src/Revolution/Processors/Element/TemplateVar/Renders/mgr/input/listbox-multiple.class.php : 80) PHP warning: Undefined array key “preserveSelectionOrder”

Suggestions for a fix please :slight_smile: Thank you.

Do you mean the settings (like “Dropdown List Options”, “Allow Blank” etc.) when editing the template variable itself (e.g. manager/?a=element/tv/update&id=1)?
Or do you mean the values you are entering for this TV in a resource (e.g. manager/?a=resource/update&id=1)?

In the first case, what are your precise settings for this TV?


I don’t think that this warning prevents the TV from running correctly.

The TV has been created for a listed of options to pull in images on the front end. The Input Type is Listbox(Multi-Select) and the dropdown list is as follows (small sample as there are quite a few)

Arabic==<img src='assets/files/tours/languages/arabic.jpg' alt='Arabic Flag' title='Arabic' />||Brazilian Portugese==<img src='assets/files/tours/languages/brazil.jpg' alt='Brazilian Flag' title='Brazilian Portugese' />||English==<img src='assets/files/tours/languages/britain.jpg' alt='British Flag' title='English' />||French==<img src='assets/files/tours/languages/france.jpg' alt='French Flag' title='French' />||German==<img src='assets/files/tours/languages/germany.jpg' alt='German Flag' title='German' />||Spanish==<img src='assets/files/tours/languages/spain.jpg' alt='Spanish Flag' title='Spanish' />

Then on the frontend this pulls in the images as small thumbs to list the language options available. All images are small to start with. I don’t have a default option because languages may not be required on each resource.

Output is delimiter.

The TV runs correctly, it just seems that the selection from the list doesn’t persist in the backend. And just to confirm I mean the values being entered into the TV in a resource don’t persist.

There seems to be a problem with HTML (especially the characters < and >) in the “Dropdown List Options” of the Listbox (Multi-Select) TV.

Unfortunately, I couldn’t identify what the exact problem is in the code.

As a workaround, maybe try using a custom snippet to output the <img> tags, instead of putting the whole tag into the TV list options.

Also if possible, open an issue about this on Github.

My guess is that the issue is connected to this pull request

Options like Arabic==<img src='arabic.jpg'>||Brazilian Portugese==<img src='brazil.jpg'> seem to have worked up to (and including) MODX 3.1.0 and stopped working with MODX 3.1.1.