HTML::...t::URL(3pm)

πŸ“¦
version 2.07000 Β· 5 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

✨ 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>


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's HTML::FormFu::Element::URL (the 3pm one). 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