Joomla radio Form Field Type

The radio form field type provides radio buttons to select different 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.

This field is mainly used in configuration with Yes/No and Show/Hide options.

XML Field Definition

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

Mandatory Parameters

  1. type must be radio.
  2. name is the unique name of the field.
  3. label (translatable) is the descriptive title of the field.

Optional Parameters

  1. default is the default radio button item value.
  2. description (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  3. layout determines how the field on the form is displayed.

Layouts

There are two layouts available:

  1. layout="joomla.form.field.radio.switcher"
  2. layout="joomla.form.field.radio.buttons" (Default)

Examples

1. Site Offline Field (Global Configuration)

<field
name="offline"
type="radio"
label="COM_CONFIG_FIELD_SITE_OFFLINE_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
filter="boolean">
  <option value="0">JNO</option>
  <option value="1">JYES</option>
</field>

2. Featured Field (com_content)

<field
name="featured"
type="radio"
label="JFEATURED"
layout="joomla.form.field.radio.switcher"
default="0">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>