[html-formfu] DBIC-FormFu extension

Mario Minati mario.minati at googlemail.com
Tue Sep 18 20:33:22 GMT 2007


I extended DBIC FormFu class with attributes:

ATTRIBUTES

The fill_formfu_values and populate_from_formfu functions can both take an 
optional hasref argument to process the field names from form field name to 
database fieldname.

The hasref takes to arguments:
    prefix_col takes a string to add to the begining of the form field names.
    suffix_col takes a string to add to the end of the form field names.


Example

If you have the following form fields:
    private_street
    private_city
    private_email
    office_street
    office_city
    office_email

You most likely would like to save both datasets in same table:
    my $private = $user->new_related( 'data', { type => 'private' } );
    $private->populate_from_formfu( $form, { prefix_col => 'private_' } );
    my $office = $user->new_related( 'data', { type => 'office' } );
    $office->populate_from_formfu( $form, { prefix_col => 'office_' } );

The table needs the following rows:
    id     (not really needed)
    street
    city
    email
    type
    user_id


Greets,
Mario



More information about the HTML-FormFu mailing list