Hidden
Zend\Form\Element\Hidden represents a hidden form input.
It can be used with the Zend\Form\View\Helper\FormHidden view helper.
Zend\Form\Element\Hidden extends from Zend\Form\Element.
Basic Usage
This element automatically adds a "type" attribute of value "hidden".
| use Zend\Form\Element;
use Zend\Form\Form;
$hidden = new Element\Hidden('my-hidden');
$hidden->setValue('foo');
$form = new Form('my-form');
$form->add($hidden);
|
Here is with the array notation:
| use Zend\Form\Form;
$form = new Form('my-form');
$form->add(array(
'type' => 'Zend\Form\Element\Hidden',
'name' => 'my-hidden',
'attributes' => array(
'value' => 'foo'
)
));
|