Radio form field type

From Joomla! Documentation

This page contains changes which are not marked for translation.
Other languages:
English • ‎Nederlands • ‎español • ‎français

The radio form field type provides radio buttons to select options. If the field has a saved value, this is selected when the page is first loaded. If not, the default value (if any) is selected.

Params.radio.jpg
  • type (mandatory) must be radio.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • default (optional) is the default radio button item value.
  • description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • class (optional) New in Joomla 3, if set to class="btn-group btn-group-yesno" will show coloured buttons

The XML <field> element must include one or more <option> elements which define the individual radio button items. The text between the <option> and </option> tags is shown as the label for the radio button and is a translatable string. The <option> tag takes the following argument:

  • value (mandatory) is the value that will be saved for the parameter if this item is selected.

Tip: Don't forget to close the field definition with </field>.

Example XML field definition:

<field name="myradiovalue" type="radio" default="0" label="Select an option" description="">
  <option value="0">1</option>
  <option value="1">2</option>
</field>

For Joomla 3+ styling with arbitrary values:

<field name="myradiovalue" type="radio" default="0" label="Select an option" description="" class="btn-group">
  <option value="0">1</option>
  <option value="1">2</option>
</field>

For Joomla 3+ styling with yes/no values:

<field name="myradiovalue" type="radio" default="0" label="Select an option" description="" class="btn-group btn-group-yesno">
  <option value="1">JYES</option>
  <option value="0">JNO</option>
</field>

See Also[edit]