Search code examples
checkboxmodx-revolution

Modx Resource List as checkbox for users


Please help, I am stuck with Modx Revo tv input type options.

What I want to achieve is have a checkbox type tv, that displays the resources of a particular parent as checkbox items. So when user checks an item or two, they will be outputted as comma separated values.

Than I will put my tv in a getresources call on the template and it will output some information form the checked resources.

So how do I convert resource list into checkbox options?

The documentation on this is very ambiguous.


Solution

  • I found an alternative way.

    1. Make TV with Input Type Checkbox.
    2. Put @SELECT pagetitle, id FROM modx_site_content WHERE parent=123 !Attn. pay attention on modx_site_content, it needs to reflect MySQL db prefix, which in this case is modx, change 123 to respective parent id.
    3. Change TV output type to Delimiter and coma (,) as delimiter.
    4. Set TV access to respective templates.

    Now you can select any or many children of a parent resource which will output their ids as TV output. E.g. let's say our parent 123 had children 33, 34 and 35. In Template variable sections of the resource using the template with access to tv, you will find a checkbox list with children titles. Selecting one or more, e.g. 33 and 35 will output "33,35" in the tv used in chunk. I found the solution in Modx forums. Lost the link unfortunately.