Elements

In This Article

Search

Zend\Form\Element\Search is meant to be paired with the FormSearch helper for HTML5 inputs with type "search"

Available since 2.9.0.

Basic Usage

This element automatically adds a type attribute of value search.

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

$search = new Element\Search('search');
$search->setLabel('Search');

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

Using array notation:

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

$form = new Form('my-form');
$form->add([
    'type' => Element\Search::class,
    'name' => 'search',
    'options' => [
        'label' => 'Search',
    ],
]);

Public Methods

This element defines no methods beyond those of the parent Element class.

Found a mistake or want to contribute to the documentation? Edit this page on GitHub!