Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

html::formfu::model::hashref(3pm) [debian man page]

HTML::FormFu::Model::HashRef(3pm)			User Contributed Perl Documentation			 HTML::FormFu::Model::HashRef(3pm)

NAME
HTML::FormFu::Model::HashRef - handle hashrefs SYNOPSIS
--- elements: - user_id - user_name - type: Repeatable nested_name: addresses elements: - type: Hidden name: id - street $form->model('HashRef')->default_values( { user_id => 123, user_name => 'Hans', addresses => [ { id => 2, street => 'Somewhere' }, { id => 3, street => 'Somewhere Else' } ] } ); $form->default_model('HashRef'); my $hashref = $form->model->create(); # $hashref is very much the same as the hashref you passed to default_values() DESCRIPTION
If you need the content of a formular as hashref or for processing with other modules like "JSON" you can use this model. METHODS
create This method creates a hashref from a filled form. This form can be filled by calling "default_values" in HTML::FormFu, default_values of any other model class (e. g. HTML::FormFu::Model::DBIC) or by simply submitting the form. If "deflators" is true all deflators are processed (defaults to 1). If "options" is true the value of all elements which have options like HTML::FormFu::Element::Select will be transformed. --- elements: - type: Select name: select options: - [1, "Foo"] - [2, "Bar"] If the value of "select" is 1, create will create this hashref: { 'select' => { label => 'Foo', value => 1 } } If there is more than one value selected, an arrayref is created instead: { 'select' => [ { label => 'Foo', value => 1 }, { label => 'Bar', value => 2 } ] } If "options" is false, the output will look like this: { 'select' => 1 } respectively { 'select' => [1, 2] } "options" is false by default. To get a flattened hash, you can set "/flatten" to a true value (defaults to 0). This will generate a hash which uses the nested name of each field as key and the value of this field as hash value. If there is a field which has more than one value, a counter is added. The above example would result in a hash like this using "/flatten": { 'select_0' => 1, 'select_1' => 2 } update Alias for "create". default_values Populate a form using a hashref. This hashref has the same format as the output of "create". If "inflators" is true, all inflators will be processed (defaults to 1). CONFIGURATION
These methods do not return the model object so chaining is not possible! options Adds the label of a value to the hashref if the element has "options" in HTML::FormFu::Element::_Group. See "create" for an example. Defaults to 0. flatten Flattens the hash using Hash::Flatten. See "create" for an example. Defaults to 0. deflators If true, processes deflators in "/create". Defaults to 1. inflators If true, processes inflators in "/default_values". Defaults to 1. SEE ALSO
HTML::FormFu, Hash::Flatten AUTHOR
Moritz Onken, "onken@houseofdesign.de" perl v5.14.2 2012-01-23 HTML::FormFu::Model::HashRef(3pm)

Check Out this Related Man Page

HTML::FormFu::Element::ComboBox(3pm)			User Contributed Perl Documentation		      HTML::FormFu::Element::ComboBox(3pm)

NAME
HTML::FormFu::Element::ComboBox - Select / Text hybrid SYNOPSIS
--- elements: - type: ComboBox name: answer label: 'Select yes or no, or write an alternative:' values: - yes - no DESCRIPTION
Creates a multi element containing a Select field and a Text field. A ComboBox element named "foo" would result in a Select menu named "foo_select" and a Text field named "foo_text". The names can instead be overridden by the "name" value in "select" and "text". If a value is submitted for the Text field, this will be used in preference to any submitted value for the Select menu. You can access the submitted value by using the ComboBox's name: my $value = $form->param_value('foo'); METHODS
default If the value matches one of the Select menu's options, that options will be selected. Otherwise, the Text field will use the value as its default. options See "options" in HTML::FormFu::Element::_Group for details. values See "values" in HTML::FormFu::Element::_Group for details. value_range See "value_range" in HTML::FormFu::Element::_Group for details. empty_first See "empty_first" in HTML::FormFu::Element::_Group for details. empty_first_label See "empty_first_label" in HTML::FormFu::Element::_Group for details. select Arguments: \%setting Set values effecting the Select menu. Known keys are: name Override the auto-generated name of the select menu. text Arguments: \%setting Set values effecting the Text field. Known keys are: name Override the auto-generated name of the select menu. CAVEATS
Although this element inherits from HTML::FormFu::Element::Block, its behaviour for the methods filter/filters, constraint/constraints, inflator/inflators, validator/validators and transformer/transformers is more like that of a field element, meaning all processors are added directly to the date element, not to its child elements. This element's get_elements and get_all_elements are inherited from HTML::FormFu::Element::Block, and so have the same behaviour. However, it overrides the "get_fields|HTML::FormFu/get_fields" method, such that it returns both itself and its child elements. SEE ALSO
Is a sub-class of, and inherits methods from HTML::FormFu::Element::Multi, HTML::FormFu::Element::Block, HTML::FormFu::Element HTML::FormFu AUTHOR
Carl Franks, "cfranks@cpan.org" LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-23 HTML::FormFu::Element::ComboBox(3pm)
Man Page