submit(), save(), save_and_back(), save_and_clear(), preview() form()
Submit buttons: submit(), save() with an icon, save_and_back() / save_and_clear() with a Back / Clear link, preview().
form()->submit($name = '', $value = '', $extra = [], $replace = [])
form()->save($name = '', $desc = '', $extra = [], $replace = [])
form()->save_and_back($name = '', $desc = '', $extra = [], $replace = [])
form()->save_and_clear($name = '', $desc = '', $extra = [], $replace = [])
form()->preview($name = '', $value = '', $extra = [], $replace = [])Options
| Option | Meaning |
|---|---|
$name, value | Posted name and value; the value (default Save) is the button text. |
desc | Button text instead of the value. |
icon | Icon class; save*() default CLASS_ICON_SAVE, preview() CLASS_ICON_PREVIEW. |
class, class_add, sizing | Default CLASS_BTN_SUBMIT; size xs, sm, lg. |
link_url, link_name | A link next to the button; save_and_back() takes $replace['back_link'] (or back_url), save_and_clear() clear_link / clear_url. |
as_input | <input type="submit"> instead of <button>. |
no_escape, disabled, target | HTML in the value; attributes. |
Example
Code
return form(['back_link' => '/docs/form', 'clear_link' => '/docs/form/submit'])
->text('title')
->submit(['value' => 'Send'])
->save()
->save_and_back()
->save_and_clear()
->preview();Notes
- The back / clear link is shown only when it holds a
/. - The button text is translated with
t().
Bootstrap 3 and 5
CLASS_BTN_SUBMIT is btn btn-default btn-primary (Bootstrap 3) or btn btn-primary (5).
See also: form/button, form/link