[html-formfu] More complex DBIC/FormFu interaction

Carl Franks fireartist at gmail.com
Thu Jan 13 14:09:03 GMT 2011


On 13 January 2011 12:38, Gabor HALASZ <halasz.g at freemail.hu> wrote:

> I think, I have same problem with my form. My config is:
>
> <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
>    <condition>
>      <id>
>        >               1
>      </id>
>    </condition>
>    <attributes>
>      <order_by>
>        -asc            action
>      </order_by>
>    </attributes>
>  </model_config>
> </elements>
>
> The form and model->default_values works well, but model->create/update
> generates a wrong query:
>
> DBI Exception: DBD::mysql::st execute failed: Column 'id' in where clause is
> ambiguous [for Statement "SELECT map_actions.id, map_actions.action,
> map_actions.method FROM Role_Action me JOIN Action map_actions ON
> map_actions.id = me.action_id WHERE ( ( id > ? AND me.role_id = ? ) )" with
> ParamValues: 0="1", 1="2"] at
> /usr/local/lib/perl5/site_perl/5.10.1/DBIx/Class/Schema.pm line 1061
>
> Without the condition, the create/update works well. The resultset
> relationship is many_to_many and my Model::DBIC newer than the linked
> revision (0.08002). What about this?

Hi,

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.

I think you need to change the "id" in the config to either "me.id" or
"map_actions.id", as appropriate.

Carl



More information about the HTML-FormFu mailing list