View Helpers

In This Article


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

$element = new Element\Select('language');
   '0' => 'French',
   '1' => 'English',
   '2' => 'Japanese',
   '3' => 'Chinese'

// Within your view...
echo $this->formSelect($element);

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