Listbox front-end out of MIGX array

All,

I have a snippet GetTvVBM-MIGX

<?php
$tvarray = $modx->runSnippet('getImageList', array('tvname' => $tvname, 'docid' => $docid));
echo $tvarray;

snippet call [[!GetTvVBM-MIGX? &tvname=plts-aanm &docid=116]]

array it echo’s

Array ( [MIGX_id] => 1 [plaats] => Alkmaar [_alt] => 0 [_first] => 1 [_last] => [idx] => 1 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 2 [plaats] => Heerhugowaard [_alt] => 1 [_first] => [_last] => [idx] => 2 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 3 [plaats] => Hoorn [_alt] => 0 [_first] => [_last] => [idx] => 3 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 4 [plaats] => Obdam [_alt] => 1 [_first] => [_last] => [idx] => 4 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 5 [plaats] => Purmerend [_alt] => 0 [_first] => [_last] => [idx] => 5 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 6 [plaats] => Velserbroek [_alt] => 1 [_first] => [_last] => [idx] => 6 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 7 [plaats] => Wijdenes [_alt] => 0 [_first] => [_last] => [idx] => 7 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 8 [plaats] => Winkel [_alt] => 1 [_first] => [_last] => [idx] => 8 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 9 [plaats] => Zaanstad [_alt] => 0 [_first] => [_last] => [idx] => 9 [property.tvname] => plts-aanm [property.docid] => 116 ) 
Array ( [MIGX_id] => 10 [plaats] => Zwaag [_alt] => 1 [_first] => [_last] => 1 [idx] => 10 [property.tvname] => plts-aanm [property.docid] => 116 )

How can i get “plaats” in a listbox in the front-end of the site, to let user select “plaats” ?

greetings

First, why create a snippet to run a snippet with the exact same parameters?
You get this array, because you did not specify a tpl to render each item to.

try this:

<select name="plaatsenlijstje">
[[getImageList?
&tvname=`plts-naam`
&docid=`116`
&tpl=`plaatsen_row`
]]
</select>

then create a chunk called plaatsen_row with the following content:

<option value="[[+plaats]]">[[+plaats]]</option>

That should work, then the snippet is not needed

Thanks Dimmy, I implemented the select, with getimagelist and added [[+selected]] in the Row tag for the tvfilters in pdopage Resource call.

Greetings,
Appeltje

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.