HTML::...erence(3pm)
πΈ NAME πΈ
HTML::FormHandler::Manual::Reference β concise reference. Bestie, you're reading the 3pm manual page, and the manual name is folded right here near the top like a little name tag. π
β¨ VERSION β¨
version 0.40068 β that's the version, no cap. π
π¦ DESCRIPTION π¦
Manual Index energy. This is a concise reference of HTML::FormHandler.
HTML::FormHandler has a lot of options and many ways to customize your forms. More complete documentation can be found in the rest of the manual as HTML::FormHandler::Manual and in HTML::FormHandler, HTML::FormHandler::Field, HTML::FormHandler::Model::DBIC, HTML::FormHandler::Render::Simple, and in the individual field classes. Slay. π
π Form π
π§Έ Form Attributes π§Έ
paramsβ HTTP parameters; if present validation will be attempted.nameβ form name. Used inidof form element.field_name_spaceβ where to search for fields.widget_name_spaceβ where to search for widgets.languageβ handle forMakeText.ctxβ application context for your use.init_objectβ for default values instead of$item.dependencyβ array of arrays of field names. If one name has a value, all fields in the list are set torequired.fieldsβ field array.sorted_fieldsβ the sorted array of fields.field( $name )β returns a field object.has_fieldβ Moose-y sugar for declaring fields.field_listβ non-moose-y way to define fields.clearβ resets state. Used in persistent forms.valueβ returns a hashref of values (with accessor keys).fifβ returns a hashref for filling in form.
ποΈ Form database attributes ποΈ
itemβ DB row object.item_classβ class of db item.item_idβ primary key of db item.schemaβ schema of item.- Also:
update_modelsub.
βοΈ Form processing βοΈ
processβ sets up form, validates, updates model.runβ returns a result object and clears form.update_field_listβ updates to fields on process.postedβ flag to say whether or not to validate, instead of depending on presence of params.
β Validation β
validateβ sub for validation after individual fields are validated.validate_modelβ sub for additional database type validation.validatedβ flag that form has validated.is_validβ synonym ofvalidated.ran_validationβ flag that validation has already been run.dependencyβ set groups of fields that are set to required if one is present.validate_$fieldnameβ validation routine for field (alsovalidate_method).
π Errors π
has_errorsβ true if any field has errors.num_errorsβ the number of errors (field errors + form errors).error_fieldsβ an array of fields with errors.errorsβ returns an array of all errors.error_field_namesβ returns an array of field names with errors.
πͺ Form Methods and process hooks πͺ
update_modelβ to perform additional database actions on update.update_fieldsβ sub providing convenient place to update fields onprocess.update_subfieldsβ sub providing place to update fields on Build (useful for roles and compound field classes).init_objectβ can be a method instead of an attribute.
π¨ Form Rendering π¨
html_prefixβ flag to prefix html field names with the form name. Useful for multiple instances of the same form.do_form_wrapperβ flag to wrap form. (build_do_form_wrapper)form_tagsβ various strings and flags used by rendering.form_element_attrβ for arbitrary html attributes in theformtag.form_element_classβ arrayref of classes forclass="..."in form element.form_wrapper_attrβ for arbitrary html attributes on the form wrapper.form_wrapper_classβ arrayref of classes forclass="..."in form wrapper.http_methodβ for storingpostorget.actionβ store the formactionon submission. No default value.enctypeβ request enctype.uuidβ generates a string containing an HTML field with UUID.styleβ adds astyleattribute to the form tag.idβ the form tagidattribute is set to the form name.html_attributesβ hook that allows customizing html attributes (form & field).
π Field specific form methods π
options_$fieldnameβ sub returning options array (alsooptions_method).validate_$fieldnameβ validation routine for field (alsovalidate_method).default_$fieldnameβ set default for field (alsodefault_method).
π Fields π
π·οΈ Field attributes π·οΈ
nameβ field name. Must be the same as database column name or rel.typeβ field type. From a Field class:Text,Select, etc.orderβ set the order for fields. Default order is set by FH.dumpβ for debugging.activeβ arrayref of fields to set active.is_activeβ listed here with no extra description in this reference.inactiveβ arrayref of fields to set inactive.is_inactiveβ listed here with no extra description in this reference.input_without_paramβ the value of the field if there is no input from the submitted form.defaultβ default value for the field.default_methodβ coderef to set default ordefault_$fieldname(by default).not_nullableβ don't convert an empty field ('', etc) to undef.trimβ transform to trim the field.deflationβ function to deflate the field (inapply) (opposite of transform).deflate_methodβ coderef to deflate the field (for filling in the form).inflate_methodβ coderef to inflate the field (before validation).inflate_default_methodβ coderef to inflate value from item/init_object.deflate_value_methodβ coderef to deflate value after validation.fif_from_valueβ flag to usevalueof field forfif.passwordβ remove from params and do not display in forms. π
π½ Select fields π½
optionsβ sorted array of hashes; keys:"value","label".options_methodβ listed as-is in this reference.label_columnβ column to use for labels (default:name).active_columnβ which values to list in options.sort_columnβ column to use for sorting (default:label_column).
π Field errors π
errorsβ errors associated with this field (alsonum_errors,clear_errors,has_errors,add_error).messagesβ hashref of message identifiers and text.
π§ͺ Field validation π§ͺ
applyβ array of constraint/coercion/transformation actions (type,check,transform,message,when).validate_methodβ validation coderef, orvalidate_$fieldnamein form (default).requiredβ field is required.required_whenβ takes a hashref of field name keys and values.missingβ flag set when arequiredorrequired_whenfails.maxlengthβ text fields. Validated.minlengthβ text fields. Used in validation.range_startβ range start for number fields.range_endβ range end for number fields.
ποΈ Field attributes for DB ποΈ
accessorβ database accessor name if different than field name.uniqueβ field should be unique in the database.noupdateβ don't update this field in the database.writeonlyβ do not retrieve initial values.- Also see: the select field
_columnsattributes.
π Field rendering π
widgetβ determines which rendering widget to use for the field.widget_wrapperβ which wrapper widget to apply to the field.element_attrβ hashref to store arbitrary html attributes.label_attrβ hashref for html attributes for the label.wrapper_attrβ hashref for html attributes for the wrapping element (div, etc).element_classβ arrayref for classes for the form element.wrapper_classβ arrayref for classes for the form element wrapper.label_classβ arrayref for classes for the form element label.labelβ text label for this field. Defaults toucfirstfield name.build_label_methodβ provide a builder forlabelattribute.wrap_label_methodβ provide a coderef to wrap the label.idβ useful for javascript (default ishtml_name; to prefix with form name, usehtml_prefixin your form).build_id_methodβ provide a builder foridattribute.do_wrapperβ flag to render wrapper.do_labelβ flag to render label.sizeβ text & select fields.renderβ widget method to render the field ($field->render).renderxβ likerenderplus set attributes:$field->render( element_class => '...' ).render_elementβ widget method to render unwrapped field ($field->render_element).render_elementxβ likerender_elementplus set attributes:$field->render_elementx( element_class => '...' ).
π§ Field attributes managed by FormHandler π§
These attributes are usually accessed in a subroutine or in a template, but are usually set only by FormHandler. (value may be changed as a transform in a validation routine.)
init_valueβ initial value from the database.valueβ the value of your field.inputβ input value from parameter or initial value from database.fifβ retrieve (do not set) values for filling in a form.
π AUTHOR π
FormHandler Contributors - see HTML::FormHandler.
βοΈ COPYRIGHT AND LICENSE βοΈ
This software is copyright (c) 2017 by Gerda Shank.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
π That's the whole page, bestie! Sign-off vibes: source/version perl v5.34.0, date 2022-03-25. Byeee! π
π¦ where this page comes from
- debian bookworm: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-formhandler-perl 0.40068-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms