Elements

Search

Laminas\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 Laminas\Form\Element;
use Laminas\Form\Form;

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

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

Using array notation:

use Laminas\Form\Element;
use Laminas\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.