On this page
View Helpers
FormUrl
The FormUrl
view helper can be used to render an <input type="url">
HTML
form input. It is meant to work with the Url element, which
provides a default input specification with an URL validator.
Basic usage
use Laminas\Form\Element;
$element = new Element\Url('my-url');
// Within your view...
echo $this->formUrl($element);
Output:
<input type="url" name="my-url" value="">
Usage of custom regular expression pattern:
use Laminas\Form\Element;
$element = new Element\Url('my-url');
$element->setAttribute('pattern', 'https?://.+');
// Within your view...
echo $this->formUrl($element);
Output:
<input type="url" name="my-url" pattern="https?://.+" value="">