Form::...:select(3pm)

πŸ“¦
version 2.5.0 Β· 2 versions
, in ubuntu jammy

πŸ’– NAME πŸ’–

Embperl::Form::Control::select β€” bestie, it's a select control living inside an Embperl Form πŸŽ€


✨ SYNOPSIS ✨

okay so here's the whole vibe, copy-paste ready:

{
type    => 'select',
text    => 'blabla',
name    => 'foo',
values  => [1,2,3],
options => ['foo', 'bar', 'none'],
rows    => 5
}

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically this thing makes a select control inside an Embperl Form. That's it, that's the job πŸ’…

If you wanna know how to actually pass in parameters, go read Embperl::Form β€” it's giving main character energy for all the param rules, and we're just living in its world.

🌸 PARAMETER 🌸

  • type β€” this one has to be 'select'. No cap. It's the whole identity of the control, bestie.
  • name β€” sets the name of the select control. That's the handle, the label the form world uses to find it πŸ”₯
  • text β€” this is what gets used as the label for the select control. Like the little caption on top. Iconic πŸŽ€
  • values β€” hands over the values as an array ref for the select control. Yes, array ref, not a plain list, don't come for me.
  • options β€” gives you the options as an array ref β€” these are the things actually displayed to the user, the visible lil menu items ✨ And lowkey important: if you don't give any options at all, it just falls back to using the values from values. Free real estate.
  • rows β€” if you specify this, you get a select box displayed with that many lines. If you don't specify it, or it's undef, you get a drop down list instead. So like, rows = big box energy, no rows = tidy lil dropdown πŸ’…
  • addtop β€” an array ref holding items that get added at the top of the select box. Each item is itself an array ref with two entries: first one is the value, second one is the option displayed on the page. And if the second one is missing, the value (the first entry) is what gets displayed. Example:
addtop => [ [1 => 'first item'], [2 => 'second item']]
  • addbottom β€” same deal but at the bottom of the select box: an array ref of items, each item an array ref with two entries, value first and displayed option second. If the second one's missing, the value (the first entry) is displayed. Example:
addbottom => [ [9999 => 'last item'], [9999 => 'very last item']]
  • filter β€” if you give this, only the items whose value matches the regex you passed in "filter" get displayed. Filtered. Curated. Only the chosen ones make it to the page πŸ‘‘
  • multiple β€” set it to true and boom, multiple selections are allowed. Go wild, pick everything, it's your moment 🫢

πŸ‘‘ Author πŸ‘‘

G. Richter (richter at embperl dot org) β€” the actual legend behind this, we stan πŸ’œ


🌈 See Also 🌈


and that's the whole page, bestie β€” brought to you by perl v5.34.0, dated 2022-02-06. slay, go build a form πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from