Package Home

Zend Framework 2 Documentation (Manual)

PHK Home

File: /_sources/modules/zend.form.element.button.txt

Size:668
Storage flags:no_autoload,compress/gzip (51%)

:orphan:

.. _zend.form.element.button:

Button
^^^^^^

``Zend\Form\Element\Button`` represents a button form input.
It can be used with the ``Zend\Form\View\Helper\FormButton`` view helper.

``Zend\Form\Element\Button`` extends from :ref:`Zend\Form\Element <zend.form.element>`.

.. _zend.form.element.button.usage:

.. rubric:: Basic Usage

This element automatically adds a ``type`` attribute of value ``button``.

.. code-block:: php
   :linenos:

   use Zend\Form\Element;
   use Zend\Form\Form;

   $button = new Element\Button('my-button');
   $button->setLabel('My Button')
          ->setValue('foo');

   $form = new Form('my-form');
   $form->add($button);

For more information about the PHK package format: http://phk.tekwire.net