[html-formfu] More complex DBIC/FormFu interaction

Octavian Rasnita orasnita at gmail.com
Fri Jan 14 10:46:12 GMT 2011


This would be a really great improvement indeed.

It could be also helpful if the form could be saved using a resultset 
method, using a code like:

For the current form:

<model_config>
resultset           Action
rs_method           update_table
</model_config>

And in MyApp::Schema::ResultSet::Action:

sub update_table {
  my ($self, %fields) = @_;
  #Here update one or more tables using the fields from %fields
}

--Octavian

----- Original Message ----- 
From: "Moritz Onken" <onken at houseofdesign.de>
To: "HTML Form Creation,Rendering and Validation Framework" 
<html-formfu at lists.scsys.co.uk>
Sent: Friday, January 14, 2011 12:13 PM
Subject: Re: [html-formfu] More complex DBIC/FormFu interaction


I think FormFu should support a way to call a resultset method.
You could move all the code there and just call it from FormFu.
Example:

in your Schema::ResultSet::Action;

sub filter_for_form {
shift->({ id => { '>' => 1 } }, { order_by => 'action' });
}

and then in FormFu:

> <elements>
>  type                  Checkboxgroup
>  name                  actions
>  label_loc             Action
>  reverse_group         0
>  <constraints>
>    type                AutoSet
>  </constraints>
>  <model_config>
>    resultset           Action
>    id_column           id
>    label_column        action
>    rs_method           filter_for_form
>  </model_config>
> </elements>



This is not yet implemented, but would look much cleaner.

Cheers,
mo

Am 13.01.2011 um 16:03 schrieb Gabor HALASZ:

> On 2011.01.13. 15:09, Carl Franks wrote:
>>
>> Tracing the code, I think the only reason default_values() isn't dying
>> is because the 'condition' isn't being used by it at all.
>
> Ok, this confused me :)
>
>>
>> I think you need to change the "id" in the config to either "me.id" or
>> "map_actions.id", as appropriate.
>
> Yes, I think about this solution (me.id works), but I wasn't sure about 
> the correct formfu's way.
>
> Thanks
>
> -- 
> Gabor HALASZ <halasz.g at freemail.hu>
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu at lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu 




More information about the HTML-FormFu mailing list