Form::...ectdyn(3pm)

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

πŸ’– Embperl::Form::Control::selectdyn β€” the 3pm manual, bestie edition πŸ’–

okay so. you found the page for Embperl::Form::Control::selectdyn (that's the 3pm manpage, hi, welcome, sit down, hydrate 🧚) β€” it's the one that gives you a dynamic select control inside an Embperl Form. yes. the little dropdown. the picker. the moment of choice. iconic behavior honestly.


✨ SYNOPSIS ✨

like, here's the vibe, in code, untouched, exactly as the ancestors wrote it:

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

that's it. that's the whole thing. it's giving config hash. πŸ’…


🌸 DESCRIPTION 🌸

so the entire point of this module: you use it to create a select control inside an Embperl Form. that's the job. that's the assignment. and if you wanna know how to actually specify parameters in an Embperl Form generally, go read Embperl::Form β€” it's the big sister page, she explains the rules.


πŸŽ€ PARAMETER πŸŽ€

every single one of these, in order, no skips, no cap:

  • type β€” has to be 'select'. yes really. that's what it says. 😌
  • name β€” the name of the select control. you're naming it. it needs a name. give it one. 🫢
  • text β€” gets used as the label for the select control. so it's the little text sitting next to your dropdown being cute.
  • values β€” the values of the select control, handed over as an array ref.
  • options β€” the options shown to the user, also an array ref. here's the tea tho: if you don't give any options, then the values from values get used instead. slay, it recycles. ♻️
  • rows β€” if you set this, you get a select box displayed with that many lines. if you don't set it, or it's undef, you get a drop down list instead. so like… rows = tall boi, no rows = compact boi. πŸ’€
  • addtop β€” array ref of items to add at the top of the select box. each item is itself an array ref with two entries: first is the value, second is the option that's displayed on the page. and if the second one is missing, then the value (the first entry) is what gets displayed. example, verbatim:
addtop => [ [1 => 'first item'], [2 => 'second item']]
  • addbottom β€” same situation but at the bottom of the select box. array ref of items, each item an array ref with two entries: first is the value, second is the option displayed on the page. if the second is missing, the value (first entry) is displayed. example:
addbottom => [ [9999 => 'last item'], [9999 => 'very last item']]

(yes both are 9999, no I'm not editing it, that's what it says πŸ™ˆ)

  • filter β€” if you give this, only items whose value matches the regex given in filter are displayed. filtering. narrowing. curating your selection. periodt. ✨
  • showurl β€” this URL gets requested when the user clicks SHOW in the popup, or double clicks the control. the value of the selected option gets appended to that url. should look something like '/foo/bar.epl?id='.
⚠️ NOTE: this URL is not encoded in any way, so make sure it's properly url encoded yourself. no one is doing it for you bestie, it's on you. 😭
  • datasrcurl β€” this URL gets requested whenever the user types any input, to fetch the data for the control. the characters the user typed get passed in the parameter query, and the name of the datasrc attribute gets passed in the datasrc parameter.
⚠️ NOTE: again β€” this URL is not encoded in any way, so make sure it's properly url encoded. same warning, same energy, don't ignore it twice. πŸ’€
  • show_on_select β€” if true, the selected item shows as soon as it's selected. (it uses showurl.)
  • use_ajax β€” if you set this to the id of an html element, then documents loaded via showurl get fetched via ajax into that html container, instead of fetching a whole entire page. glow up. 🌈
  • $fdat{-init-<name>} β€” if this is set, the value gets used to prefill the input box. if it's not set, then the get_values method of the datasource object gets called β€” and ngl, that can take a long time if you've got a lot of options. so like… fair warning. 🫠

πŸ‘‘ Author πŸ‘‘

G. Richter (richter at embperl dot org). thank you for your service king 🫑


πŸ¦‹ See Also πŸ¦‹

perl(1), Embperl, Embperl::Form β€” go read them, they're all connected, iykyk πŸ’œ


and that's the whole page babes, no notes, go build something iconic πŸ’…

this has been perl v5.34.0, dated 2022-02-06, brought to you by the Form::...ectdyn(3pm) manual β€” mwah, bye, love u, read your manpages πŸŽ€βœ¨

πŸ“¦ where this page comes from