Skip to content

Commit

Permalink
Merge pull request #319 from marcorensch/patch-2
Browse files Browse the repository at this point in the history
Update radio.md
  • Loading branch information
HLeithner authored Oct 18, 2024
2 parents 1b32c46 + f28f88d commit 0748e99
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
20 changes: 18 additions & 2 deletions docs/general-concepts/forms-fields/standard-fields/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The **radio** form field type provides radio buttons to select options. If the f
- **description** (optional) (translatable) is the [field description](../standard-form-field-attributes.md#description).
- **default** (optional) is the default password.
- **class** (optional) is a CSS class name for the HTML form field. If set to `class="btn-group btn-group-yesno"` will show coloured buttons.
- **layout** (optional) can be used to set a Layout for the switcher. Eg. if set to `layout="joomla.form.field.radio.switcher"` will use the Joomla Radio-Switcher Layout.

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:

Expand Down Expand Up @@ -59,8 +60,23 @@ Styling with yes/no values:
label="Select an option"
description=""
class="btn-group btn-group-yesno">
<option value="0">1</option>
<option value="1">2</option>
<option value="0">JNo</option>
<option value="1">JYes</option>
</field>
```

Styling with yes/no values as Switcher:

```xml
<field
name="myradiovalue"
type="radio"
default="0"
label="Select an option"
description=""
layout="joomla.form.field.radio.switcher">
<option value="0">JNo</option>
<option value="1">JYes</option>
</field>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The **radio** form field type provides radio buttons to select options. If the f
- **description** (optional) (translatable) is the [field description](../standard-form-field-attributes.md#description).
- **default** (optional) is the default password.
- **class** (optional) is a CSS class name for the HTML form field. If set to `class="btn-group btn-group-yesno"` will show coloured buttons.
- **layout** (optional) can be used to set a Layout for the switcher. Eg. if set to `layout="joomla.form.field.radio.switcher"` will use the Joomla Radio-Switcher Layout.

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:

Expand Down Expand Up @@ -59,10 +60,25 @@ Styling with yes/no values:
label="Select an option"
description=""
class="btn-group btn-group-yesno">
<option value="0">1</option>
<option value="1">2</option>
<option value="0">JNo</option>
<option value="1">JYes</option>
</field>
```

Styling with yes/no values as Switcher:

```xml
<field
name="myradiovalue"
type="radio"
default="0"
label="Select an option"
description=""
layout="joomla.form.field.radio.switcher">
<option value="0">JNo</option>
<option value="1">JYes</option>
</field>
```

## See also
* [List form field type](./list.md)
* [List form field type](./list.md)

0 comments on commit 0748e99

Please sign in to comment.