Fork me on GitHub

checkbox

An article by Gaspard Bucher

Display a set of checkboxes/radio buttons to create links.

Display a set of checkboxes/radio buttons to create links.

  • label (true, false, t, dyn str) prefix with a label field.
  • role relation involved
  • nodes can be “1,2,7” or “images”
  • in set the scope of the values when using a relation
  • ... see unknown for all options
  • values literal values separated by commas
  • show values to display (optional)
  • tshow translate values to display (either one by one or the complete list)
  • tprefix prefix to use before translating value (a ”_” is added between prefix and value)
  • default value for hidden field (when none is checked)
see label, toggle
<r:checkbox role='blog' nodes='1'/>

<r:checkbox role='icon' nodes='images' in='project'/>

If the target relation is unique (has one), like for “icon”, this method displays radio buttons. Otherwise, checkboxes are displayed.

radio is an alias for “checkbox”.

literal values

You can also use the checkbox with literal values:

<r:checkbox values='1,10,15' show='new, processing, ready' name='status'/>

If you use translations, you can use tshow:

<r:checkbox values='1,10,15' tshow='status_list' name='status'/>

Or tprefix:

<r:checkbox values='1,10,15' tprefix='foo' name='status'/>
<!-- values will be translation of "foo_1", "foo_10", "foo_15" -->

You can omit the “tprefix” setting if it is the same as the attribute name (“status” here).