Group 'input option values' in template variable with 'listbox' type

797 views Asked by At

I would like to apply the grouped text in listbox, looks like this
1
to
enter image description here this is listbox in the resources page.

I tried to add the ‘optgroup’ tag into 'manager\templates\default\element\tv\renders\input\listbox-multiple.tpl' but still not working, the 'optgroup’ tag will be ignored.

I unterstand that I should ‘Adding a Custom TV Input Type’ but the document didn’t include the details about grouping input values.

1

There are 1 answers

0
user9527 On BEST ANSWER

That is easy ;) your listbox should contain a @CHUNK yourchunk In that chunk you can perform nearly everything, that genereates a list, like:

    <select name="something" id="something" >
    <option value="" selected disabled>choose</option>
    <optgroup label="Headline 01">
    [[pdoResources? &parents=`0` &where=`{"template:=":40` &sortby=`{"value":"ASC"}` &limit=`40` &tpl=`pdoResourcesFormoption-something` &includeTVs=`some-tv`]]
    </optgroup>

    <optgroup label="Headline 02">
    [[pdoResources? &parents=`0` &where=`{"template:=":41` &sortby=`{"value":"ASC"}` &limit=`40` &tpl=`pdoResourcesFormoption-something` &includeTVs=`some-tv`]]
    </optgroup>

    <optgroup label="Headline 03">
    [[pdoResources? &parents=`0` &where=`{"pagetitle:=":"something"` &sortby=`{"value":"ASC"}` &limit=`40` &tpl=`pdoResourcesFormoption-something` &includeTVs=`some-tv`]]
    </optgroup>