On this page
Caution
The documentation you are viewing is for an older version of this component.
Switch to the latest (v3) version.
Elements
Button
Laminas\Form\Element\Button
represents a button form input.
It can be used with the Laminas\Form\View\Helper\FormButton
view helper.
Laminas\Form\Element\Button
extends from Laminas\Form\Element
.
Basic Usage
This element automatically adds a type
attribute of value button
.
use Laminas\Form\Element;
use Laminas\Form\Form;
$button = new Element\Button('my-button');
$button->setLabel('My Button');
$button->setValue('foo');
$form = new Form('my-form');
$form->add($button);