[html-formfu] How to prefill form from Session

Carl Franks fireartist at gmail.com
Tue Oct 18 10:55:29 GMT 2011


On 18 October 2011 11:46, abhishek jain <abhishek.netjain at gmail.com> wrote:
>
>
> On Tue, Oct 18, 2011 at 4:10 PM, Carl Franks <fireartist at gmail.com> wrote:
>>
>> On 18 October 2011 11:30, abhishek jain <abhishek.netjain at gmail.com>
>> wrote:
>> > How to prefill form from session, iam doing multi step form and i need a
>> > way
>> > to persist values via session till last step.
>> > Also how to prefill from database,
>>
>> For integration with DBIx::Class, see HTML::FormFu::Model::DBIC
>
> Can i use formfu to prefill fields by field, i mean from a variable, as i
> dont want to write a plugin now and dont want to use hidden form field,

Hi,
To set the default value on a single field, use
    $field->default( $value );

To do the same for multiple fields, do
    $form->default_values({
        field1 => $value1,
        field2 => $value2,
    });

For a more complicated set (read: nested blocks/fields), see
HTML::FormFu::Model::HashRef.

If you use any of these, you must then always call $form->process()
before displaying the form to the user.

Cheers,
Carl



More information about the HTML-FormFu mailing list