[html-formfu] Join two fields?

Carl Franks fireartist at gmail.com
Mon May 5 12:22:10 BST 2008


I've committed a new Filter::CompoundJoin and a new Deflator::CompoundSplit

They are intended for use with a Multi element, which must be named.
Example of use:

    ---
    element:
      - type: Multi
        name: address

        elements:
          - name: number
          - name: street

        deflator:
          - type: CompoundSplit

        filter:
          - type: CompoundJoin

# set a default on the 'address' field

$form->get_field('address')->default( '10 Downing Street' );

# the Deflator splits this, so it renders as

< input name="number" value="10" />
< input name="street" value="Downing Street" />

# submit values

$form->process({
    'address.number' => '10',
    'address.street' => 'Downing Street',
});

# the Filter changes this to a single value on the 'address' field

my $address = $form->param_value('address'); # "10 Downing Street"

Check the pod/docs for methods to change the split regex, the join
string, and field ordering.

Cheers,
Carl



More information about the HTML-FormFu mailing list