I have a listbox (multiple) inside a MIGX tv I put together. But I’m having trouble with the output. I have a need for a dropdown of all attorneys in our database so I can output specific items from their bios.
To do this, I used this for my InputOptionValues in my TV:
“inputOptionValues”:“@SELECTpagetitle, attorney.id AS id, tlastnamevalue.value AS lastname FROM modx_site_contentattorney LEFT JOIN modx_site_tmplvar_contentvalues tlastnamevalue ON tlastnamevalue.contentid = attorney.id AND tlastnamevalue.tmplvarid = 10 WHERE published = 1 AND deleted = 0 AND (parent = 1 OR parent = 2 OR parent = 3 ) ORDER BY pagetitle ASC”
This got me my list, but when I use it, all I’m getting as a result is the resource ID (which is expected). However, what isn’t expected is that when I select multiple items, it combines the resource IDs rather than showing a delimiter.
Instead of 22,23 or 22||23, I’m getting 2223.
Any ideas on how to fix this? I tried searching for this and only found an unanswered article I posted from 2 years ago. >_<
Yes, it’s when i’m reading the data. Here’s my full process if this helps. The testing page.
The full TV:
[
{"caption":"Info", "fields":
[
{"field":"GroupName","caption":"Name of the Group","inputTVtype":"text"},
{"field":"Logo","caption":"Group Logo","inputTVtype":"image"},
{"field":"GroupDescription","caption":"Description","inputTVtype":"richtext"}
]
},
{"caption":"People","fields":
[
{ "field":"GroupChair",
"caption":"Chairperson",
"inputTVtype":"listbox-multiple",
"inputOptionValues":"@SELECT `pagetitle`, attorney.id AS `id`, `tlastnamevalue`.`value` AS `lastname` FROM `modx_site_content` `attorney` LEFT JOIN modx_site_tmplvar_contentvalues tlastnamevalue ON tlastnamevalue.contentid = attorney.id AND tlastnamevalue.tmplvarid = 69 WHERE `published` = 1 AND `deleted` = 0 AND (`parent` = 1 OR `parent` = 2 OR `parent` = 3) ORDER BY `pagetitle` ASC",
"config":{"typeAhead":false,"typeAheadDelay":250,"minChars":3}
}
]
}
]
so in this example, I’m looking at the [[+GroupChair]] line and for the entry with more than one person, the resource IDs are combining. When I rename the chunk tpl and view the array in full, I get this:
Array
(
[MIGX_id] => 2
[GroupName] => Buchanan N.O.W.
[Logo] => assets/images/Logos/diversity-NOW.jpg
[GroupDescription] =>
Buchanan N.O.W (Network of Women) is the affinity group for employees who identify as women.
[GroupChair] => 649225
[GroupMembers] =>
[_alt] => 1
[_first] =>
[_last] =>
[idx] => 2
[property.tvname] => diversityAffinityGroupsList
[property.tpl] => affinityGroupsTpl2
)