Form::...ectdyn(3pm)
π 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 fromvaluesget 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'sundef, 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 infilterare 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 parameterquery, and the name of thedatasrcattribute gets passed in thedatasrcparameter.
β οΈ 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 usesshowurl.)use_ajaxβ if you set this to the id of an html element, then documents loaded viashowurlget 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 theget_valuesmethod 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
- ubuntu jammy: libembperl-perl 2.5.0-16build1 Β· 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