|
Size: | 11245 |
Storage flags: | no_autoload,compress/gzip (27%) |
The FormRange view helper can be used to render a <input type="range"> HTML form input. It is meant to work with the Zend\Form\Element\Range element, which provides a default input specification for validating numerical values.
FormRange extends from Zend\Form\View\Helper\FormInput.
Basic usage:
1 2 3 4 5 6 | use Zend\Form\Element;
$element = new Element\Range('my-range');
// Within your view...
echo $this->formRange($element);
|
Output:
1 | <input type="range" name="my-range" value="">
|
Usage of min, max and step attributes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | use Zend\Form\Element;
$element = new Element\Range('my-range');
$element->setAttributes(
array(
'min' => 0,
'max' => 100,
'step' => 5,
)
);
$element->setValue(20);
// Within your view...
echo $this->formRange($element);
|
Output:
1 | <input type="range" name="my-range" min="0" max="100" step="5" value="20">
|
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.