MIGX listbox-multiple and @SELECT binding

Continuing the discussion from Joined tables using MIGXdb:

I’ve successfully managed to show data using a custom renderer, and for single ID’s as well. I’m having a problem when the field author contains multiple ID’s → 100, 231.

My input TV type is listbox-multiple
Input option values are: @SELECT CONCAT(`name`, ' ', `surname`) AS `fullname` , uid FROM modx_prevodi_avtor

I have a feeling this has something to do with delimiters - my database contains values separated with a comma. When looking at an entry with only one author (so there’s no delimiters) it select the correct one, but when there are multiple it doesn’t seem to work (stays blank).

You probably have to add an aftergetfields snippet to convert the data of your “authors” field on loading (replacing , with ||), so the format is correct for the “listbox-multiple” field.

And a beforesave snippet to convert it back, before it is saved to the database.

(Alternatively, you could create custom “fields” and “update” processors.)

1 Like

Yep, the delimiters were the problem. I could just replace them in the DB, everything started working as expected :slight_smile:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.