radio_box() table()
A group of radio buttons in each row, posting field[value] = the picked choice for every row.
table()->radio_box($name, $extra = [])Options
| Option | Meaning |
|---|---|
values | Value => label of the choices (required: without it the cells are empty). |
selected | Choice checked in every row. |
name | Posted name; default the field name; [value] is appended unless it holds a [. |
(html options) | Every option of html()->radio_box(): horizontal, translate, class_add... |
Example
Code
$rows = [
1 => ['id' => 1, 'name' => 'Comment by anna'],
2 => ['id' => 2, 'name' => 'Comment by bohdan'],
];
return table($rows, ['no_pages' => 1])
->text('name')
->radio_box('id', ['name' => 'moderate', 'values' => ['keep' => 'Keep', 'hide' => 'Hide'], 'selected' => 'keep', 'desc' => 'Decision'])
->footer_submit('Apply');Notes
- Here each row posts
moderate[1],moderate[2]... withkeeporhide. - It calls form().
See also: table/check_box, html/radio_box