HTML::...:Input(3pm)

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

HTML::FormFu::Role::Element::Input πŸ’…

okay bestie, welcome to the HTML::FormFu::Role::Element::Input page (she lives in the HTML::...:Input(3pm) manpage slot, iykyk) πŸŽ€

✨ VERSION ✨

version 2.07 β€” yeah she's been around, and she's still iconic πŸ¦‹


🌸 DESCRIPTION 🌸

So basically?? This is the base-class for a whole lil squad of input elements. Not me listing the entire friend group but here we go, she's the mother of:

  • HTML::FormFu::Element::Button
  • HTML::FormFu::Element::Checkbox
  • HTML::FormFu::Element::File
  • HTML::FormFu::Element::Hidden
  • HTML::FormFu::Element::Password
  • HTML::FormFu::Element::Radio
  • HTML::FormFu::Element::Text

that's the roster, no cap πŸ‘‘


πŸ’– METHODS πŸ’–

datalist_options

Arguments: none

Arguments: \@options

okay so use datalist_options or datalist_values to generate a HTML5-compatible datalist group of option tags ✨ This gets associated with the input element via a list attribute on the input tag. it's giving teamwork fr.

the datalist ID attribute must be set using either datalist_id or auto_datalist_id. like, non-negotiable bestie πŸ’…

---
elements:
  - type: Text
    name: foo
    options:
      - [ 01, January ]
      - [ 02, February ]
      - [ 03, March ]
      - [ 04, April ]

the syntax is similar to options in HTML::FormFu::Role::Element::Group, except hash-ref items only accept value and label keys (and their variants). the way that's so specific of her 🫢

if you pass no arguments, she returns an arrayref of the currently set datalist options. cute right?

her arguments must be an array-ref of items. each item may be an array ref of the form [ $value, $label ] or a hash-ref of the form { value => $value, label => $label }.

when you're using the hash-ref construct, the label_xml and label_loc variants of label are supported, and so are the value_xml and value_loc variants of value. slay πŸ’–

datalist_values

Arguments: \@values

---
elements:
  - type: Radiogroup
    name: foo
    values:
      - jan
      - feb
      - mar
      - apr

a more concise alternative to datalist_options. lowkey the low-effort version and we love her for it 🌸

her arguments must be an array-ref of values. the labels used are the result of ucfirst($value). that's it, that's the whole vibe.

datalist_id

Arguments: [$string]

sets the datalist ID attribute, and automatically sets this input element's list ID to the same. two birds, one attribute ✨

either datalist_id or auto_datalist_id is required, if either datalist_options or datalist_values are set. don't skip this step bestie, she will notice 😭

auto_datalist_id

see auto_datalist_id in HTML::FormFu for details. go read the other page, it's a whole thing πŸ“–


🌈 ATTRIBUTE ACCESSORS 🌈

get / set input attributes directly with these methods. direct communication, we stan 🫢

Arguments: [$string]

Return Value: $string

  • alt
  • autocomplete
  • checked
  • maxlength
  • pattern
  • placeholder
  • size

πŸ”₯ BOOLEAN ATTRIBUTE ACCESSORS πŸ”₯

Arguments: [$bool]

Return Value: $self Return Value: $string Return Value: undef

get / set boolean XHTML attributes such as required="required".

if you give her any true argument, the attribute value gets set equal to the attribute key name. e.g. $element->required(1) will set the attribute required="required". periodt πŸ’…

if you give her a false argument, the attribute key gets deleted. gone. ghosted. πŸ’€

when used as a setter, the return value is $self to allow chaining. chain her, she loves it πŸ”—

  • autofocus
  • multiple
  • required

πŸ¦‹ SEE ALSO πŸ¦‹

is a sub-class of, and inherits methods from HTML::FormFu::Role::Element::Field, HTML::FormFu::Element

HTML::FormFu


πŸ‘‘ 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.


πŸ’œ 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.


and that's the whole page bestie, you ate πŸ’…βœ¨

perl v5.28.1 Β· 2019-01-12 β€” mwah, love u, go build something gorgeous πŸ¦‹πŸ’–πŸŒΈ

πŸ“¦ where this page comes from