HTML::...erence(3pm)

πŸ“¦
version 0.40068 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute

🌸 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 in id of form element.
  • field_name_space β€” where to search for fields.
  • widget_name_space β€” where to search for widgets.
  • language β€” handle for MakeText.
  • 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 to required.
  • 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_model sub.

βš™οΈ 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 of validated.
  • 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 (also validate_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 on process.
  • 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 the form tag.
  • form_element_class β€” arrayref of classes for class="..." in form element.
  • form_wrapper_attr β€” for arbitrary html attributes on the form wrapper.
  • form_wrapper_class β€” arrayref of classes for class="..." in form wrapper.
  • http_method β€” for storing post or get.
  • action β€” store the form action on submission. No default value.
  • enctype β€” request enctype.
  • uuid β€” generates a string containing an HTML field with UUID.
  • style β€” adds a style attribute to the form tag.
  • id β€” the form tag id attribute 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 (also options_method).
  • validate_$fieldname β€” validation routine for field (also validate_method).
  • default_$fieldname β€” set default for field (also default_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 or default_$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 (in apply) (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 use value of field for fif.
  • 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 (also num_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, or validate_$fieldname in form (default).
  • required β€” field is required.
  • required_when β€” takes a hashref of field name keys and values.
  • missing β€” flag set when a required or required_when fails.
  • 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 _columns attributes.

πŸŽ€ 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 to ucfirst field name.
  • build_label_method β€” provide a builder for label attribute.
  • wrap_label_method β€” provide a coderef to wrap the label.
  • id β€” useful for javascript (default is html_name; to prefix with form name, use html_prefix in your form).
  • build_id_method β€” provide a builder for id attribute.
  • 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 β€” like render plus set attributes: $field->render( element_class => '...' ).
  • render_element β€” widget method to render unwrapped field ($field->render_element).
  • render_elementx β€” like render_element plus 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.

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