[html-formfu] More complex DBIC/FormFu interaction

Carl Franks fireartist at gmail.com
Tue Aug 31 15:32:40 GMT 2010


On 31 August 2010 13:19, Nigel Metheringham
<nigel.metheringham at dev.intechnology.co.uk> wrote:
>
>    # splice event info into the form as a restriction
>    my $element = $form->get_element( { name => 'bookings' } );
>    my $modelcf = $element->model_config();
>    $modelcf->{condition} = { event => $event->id };
>    $element->model_config($modelcf);
>    $form->process;    # need to redo this explicitly due to change above

I'm not sure whether it's this - but model_config() uses
HTML::FormFu::Util::merge_hashes() to merge any argument passed with
its already-existing data.

Because $modelcf is a reference you shouldn't need to to pass it back
to model_config() to update it.
So either just delete that line, or make it a more visually-explicit lvalue.

$form->get_field('bookings')->model_config->{condition} = { event =>
$event->id };

Hope this helps,
Carl



More information about the HTML-FormFu mailing list