[html-formfu] Join two fields?
Moritz Onken
onken at houseofdesign.de
Thu May 8 16:51:17 BST 2008
Thanks Carl,
great work!
Am 05.05.2008 um 13:22 schrieb Carl Franks:
> 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
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.rawmode.org
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
More information about the HTML-FormFu
mailing list