|
Size: | 11351 |
Storage flags: | no_autoload,compress/gzip (27%) |
The FormWeek view helper can be used to render a <input type="week"> HTML5 form input. It is meant to work with the Zend\Form\Element\Week element, which provides a default input specification for validating HTML5 week values.
FormWeek extends from Zend\Form\View\Helper\FormDateTime.
Basic usage:
1 2 3 4 5 6 | use Zend\Form\Element;
$element = new Element\Week('my-week');
// Within your view...
echo $this->formWeek($element);
|
Output:
1 | <input type="week" name="my-week" 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\Week('my-week');
$element->setAttributes(
array(
'min' => '2012-W01',
'max' => '2020-W01',
'step' => 2, // weeks; default step interval is 1 week
)
);
$element->setValue('2014-W10');
// Within your view...
echo $this->formWeek($element);
|
Output:
1 | <input type="week" name="my-week" min="2012-W01" max="2020-W01" step="2" value="2014-W10">
|
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.