On this page
Caution
The documentation you are viewing is for an older version of this component.
Switch to the latest (v3) version.
View Helpers
FormSelect
The FormSelect
view helper can be used to render an <input type="select">
HTML form input with its options. It is meant to work with the Select element,
which provides a default input specification for validating a select.
Basic usage
use Laminas\Form\Element;
$element = new Element\Select('language');
$element->setValueOptions([
'0' => 'French',
'1' => 'English',
'2' => 'Japanese',
'3' => 'Chinese'
]);
// Within your view...
echo $this->formSelect($element);