HTML::...t::URL(3pm)
β¨ NAME β¨
HTML::FormFu::Element::URL β it's the HTML5 URL form field, bestie π
(yes the manpage header literally says HTML::...t::URL(3pm) because somebody's terminal was not invited to the full name party, but it's her)
π VERSION π
version 2.07 β iconic, current, no notes π«Ά
πΈ SYNOPSIS πΈ
my $element = $form->element( URL => 'foo' );
# no need to add a separate constraint
okay so notice that comment? that's the whole point. she handles the constraint herself. you literally do not have to lift a finger π§
π DESCRIPTION π
It's an HTML5 URL form field, and she comes with native client-side validation in modern browsers. So the browser is doing the vibe check for you before anything even hits the server β¨
She creates an input field with <type="url">.
She also sets the pattern attribute, which restricts the client-side validation to only the schemes you actually want (http and/or https). no random gopher:// situations here π
And β this is the slay part β this element automatically adds a Regex constraint, so you don't have to. she already did it. periodt π
If neither http_only nor https_only are set, the constraint allows any HTTP or HTTPS url. both flavors welcome, she's not picky π
π METHODS π
π http_only
π https_only
these two are the switches that tell her which scheme(s) you're feeling. flip the one you want and the client-side validation narrows accordingly β see DESCRIPTION above for what happens when you set neither π«
π message
Arguments: $string
Sets the error message on the Regex constraint which is automatically added. so when the validation goes "bestie that is not a url", this is the text that gets said π¬
π message_xml
Arguments: $string
If you don't want your error message to be XML-escaped, use the message_xml method instead of message. like, if you need the raw characters to come through exactly as you typed them, this is the one π₯
π message_loc
Arguments: $localization_key
Sets the error message using a L10N key. so instead of hardcoding the string, you point at a localization key and let the translation squad handle it π
π SEE ALSO π
She is a sub-class of, and inherits methods from HTML::FormFu::Role::Element::Input, HTML::FormFu::Role::Element::Field, and HTML::FormFu::Element. the whole family tree, all iconic, all relevant if you want to know where a method came from π«Ά
Also: HTML::FormFu β the parent framework, the main character herself π
π AUTHOR π
Carl Franks, cfranks@cpan.org
π LICENSE π
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. open source behavior, we love to see it π
π AUTHOR π
Carl Franks <cpan@fireartist.com>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2018 by Carl Franks.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay and one tiny housekeeping note before you go: this page is perl v5.28.1, dated 2019-01-12, and it'sHTML::FormFu::Element::URL(the3pmone). that's the source, that's the version, that's the date, all accounted for π β¨ bye bestie, go validate some urls π¦
π¦ where this page comes from
- debian bookworm: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formfu-perl 2.07000-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms