Form(3pm)
π Form(3pm) β the Embperl::Form glow-up π
okay so bestie, welcome to Embperl::Form, aka the Embperl Form class. this is the page for it, and it's giving "build me a whole form, queen" energy. let's get into it π«Ά
β¨ SYNOPSIS β¨
soooo... there's literally nothing here. the synopsis is empty. iconic of it, honestly. no sample code, no teaser, just vibes π
πΈ DESCRIPTION πΈ
also empty!! the description said "no thoughts, head empty" and honestly? we respect it. everything you need lives down in METHODS. keep scrolling, babe π¦
π METHODS π
new ($controls, $options)
the constructor, the main character, the one who gets the party started β¨ it takes two things:
$controlsβ an array ref with all the controls that should show up inside the form. every single control in there has to either be a hashref carrying all the parameters for that control, or be an actual control object. and if you're passing plain hashrefs, you have to specify the"type"parameter, otherwiseEmbperl::Formhas no clue which control to make for you. for the full list of parameters you can use, go peek atEmbperl::Form::ControlandEmbperl::Form::Control::*π$optionsβ a hash ref, and it can take all of these:formnameβ gets used as thenameandidattribute of the form. lowkey important: if you've got more than one form on a page, you need different form names or form validation will not work correctly. periodt.masksβ holds a hash ref that can specify a set of masks for the controls. a mask is a set of parameters that overwrite the settings of a control. you can give a mask for a control name (the key is the name), for a control type (the key is*type), or for all controls (the key is*).
example:
{
'info' => { readonly => 1},
'*textarea' => { cols => 80 },
'*' => { labelclass => 'myclass', labelnowrap => 1}
}
what this does: forces the control named "info" to be readonly, forces every "textarea" control to have 80 columns, and forces the label of all controls to have a class of myclass and to not wrap the text. slay π₯
defaultsβ holds a hash ref that can specify a set of defaults for the controls. same deal as masks: you can set a default for a control name (key is the name), for a control type (key is*type), or for all controls (key is*).
example:
{
'info' => { readonly => 1},
'*textarea' => { cols => 80 },
'*' => { labelclass => 'myclass', labelnowrap => 1}
}
what this one does: makes the control named "info" default to readonly, defaults all "textarea" controls to 80 columns, and sets the default class for the labels of all controls to myclass plus no text wrapping β¨
languageβ the language setting, used forEmbperl::Form::Validate, like'en'or'de'πcharsetβ the charset setting, used forEmbperl::Form::Validate, like'utf-8'valignβ the valign for control cells. defaults to'top'πjsnamespaceβ gives the JavaScript Namespace. this lets you load js files in a top frame or a different frame, which speeds up page loading, because the browser doesn't have to reload the js code on every load. chef's kiss efficiency π§
example:
jsnamespace => 'top'
classdivβ gives the CSS class of the DIV around the form. default iscTableDivπcheckitemsβ if you set this to true, it lets you call the functiondiff_checkitemsafter the data is posted, so you can see which form fields changed. detective mode activated πcontrol_packagesβ an arrayref with package names to search for form controls. alternatively, you can overwrite the methodget_control_packages.datasrc_packagesβ an arrayref with package names to search for form data source modules. alternatively, you can overwrite the methodget_datasrc_packages.
layout
just a name, bestie. no extra deets on this one in the page. it's there, it exists, it's living its truth π
validate
same situation β it's listed, and that's all the page tells us. no cap.
show
also just listed. short and mysterious, love that for it π¦
convert_label
converts the label of a control into the text that should be outputted. by default it returns the text or name parameter of the control. you can overwrite it so you can do stuff like internationalization π
$ctrlβ anEmbperl::Form::Controlobject$nameβ optional: the name to translate. if it's not given, it takes$ctrl -> {name}
convert_text
converts the text of a control into the text that should be outputted. by default it returns the text or name parameter of the control. overwrite it if you wanna do things like internationalization π
$ctrlβ anEmbperl::Form::Controlobject
convert_options
converts the values of a control into the text that should be outputted. by default it does nothing at all (respect, honestly). overwrite it if you wanna do things like internationalization β¨
$ctrlβ anEmbperl::Form::Controlobject$valuesβ values of the control, i.e. the values that are submitted$optionsβ options of the control, i.e. the text that should be displayed
π AUTHOR π
G. Richter (richter at embperl dot org) β thank you for your service, legend π
π SEE ALSO π
perl(1), Embperl, Embperl::Form::Control β go read these next, bestie, they're the supporting cast π«Ά
and that's the whole page, babe!! this was pulled from perl v5.34.0, dated 2022-02-06, and it's part of the User Contributed Perl Documentation. mwah π go build something gorgeous β¨
π¦ 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