| 
| Size: | 10326 | 
| Storage flags: | no_autoload,compress/gzip (28%) | 
The FormUrl view helper can be used to render a <input type="url"> HTML form input. It is meant to work with the Zend\Form\Element\Url element, which provides a default input specification with an URL validator.
FormUrl extends from Zend\Form\View\Helper\FormInput.
Basic usage:
1 2 3 4 5 6  | use Zend\Form\Element;
$element = new Element\Url('my-url');
// Within your view...
echo $this->formUrl($element);
 | 
Output:
1  | <input type="url" name="my-url" value="">
 | 
Usage of custom regular expression pattern:
1 2 3 4 5 6 7  | use Zend\Form\Element;
$element = new Element\Url('my-url');
$element->setAttribute('pattern', 'https?://.+');
// Within your view...
echo $this->formUrl($element);
 | 
Output:
1  | <input type="url" name="my-url" pattern="https?://.+" value="">
 | 
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.