SetInputOptions

setinputoptions

  • By qaraqter
  • Latest release May 19, 2015 (11 years ago)

About

SetInputOptions is a very basic CMP that allows you to create groups with their own input options. These options can then be used in TV's, for checkboxes / listboxes etc. This is a better / safer method than the regular way of creating these options (option1==1||option2==2), leaving them vulnerable to typo's and deletion.

Installation & usage

How to use the SetInputOptions extra for MODX

  • Install SetInputOptions through the package manager
  • Go to Extra's > Set Input Options and create a group with some options
  • Create a TV with an @SELECT binding to your custom input options as Input Option Value (see example below)
  • Fetch the input option values in your content with the getInputOptions or Rowboat snippets

Connect your TV to your custom input options

An example of an @SELECT binding for checkboxes and radios:

@SELECT `name` AS `name`,`id` FROM `[[+PREFIX]]setinputoptions_inputoptions` WHERE `group` = 2 AND `softDelete` = 0 ORDER BY `position`

An example @SELECT binding for listboxes and multiselects. Note the first part up till `UNION ALL`, this adds an empty first item to your TV.

@SELECT '' AS name, '' AS id UNION ALL ( SELECT `name` AS `name`,`id` FROM `[[+PREFIX]]setinputoptions_inputoptions` WHERE `group` = 1 AND `softDelete` = 0 ORDER BY `position` )

Display input option values using the getInputOptions snippet

[[getInputOptions? &tv=`[[*your_template_variable]]`]]

Available properties:

  • tpl
  • delimiter
  • outputDelimiter

Available placeholders in the row tpl:

  • name
  • alias

Display input option values using the Rowboat snippet

You can also use Rowboat to list all the options in a group. Useful for example, for creating filter buttons. Don't forget to download and install Rowboat separately through package manager!

[[Rowboat?    &table=`modx_setinputoptions_inputoptions`    &tpl=`filterButtonsRow`    &limit=`10`    &sortBy=`position`    &where=`{"group":"1"}`]]

At a glance

MODX 3 compatibility unknown. Based on our testing and community reports where available.

  • Developer qaraqter
  • Latest release May 19, 2015 (11 years ago)
  • First seen in SiteDash May 18, 2015 (11 years ago)
  • License GPLv2
  • MODX support 2.2 – 100.0

Releases 1 indexed release

Changelog
MODX.com

1.0.3-pl

May 19, 2015

11 years ago

—

We've also seen 2 unverified versions of SetInputOptions in use, but don't list those as we've been unable of confirming they are official releases from an official source.