[html-formfu] "Column 'id' in field list is ambiguous"

Carl Franks fireartist at gmail.com
Thu Dec 4 08:38:34 GMT 2008


2008/12/4 Jens Schwarz <blacky6767 at gmx.de>:
> Hi,
>
> I don't know if the problem I have is the same as in http://lists.scsys.co.uk/pipermail/html-formfu/2008-January/000845.html . pmvers HTML::FormFu tells me that I am running FormFu 0.03005.

It looks like it may be the same issue.
If you follow the responses in that thread, you'll see it was fixed -
though you'll need to make a slight change to your form config file.

Since that thread, HTML::FormFu::Model::DBIC has been moved out to a
separate distribution - so make sure you're running at least v0.03000
of HTML-FormFu-Model-DBIC.
The version of HTML-FormFu isn't relevant.

>    my @genreobj = $c->model('My::Genres')->all();
>    my @genres;
>    foreach my $g (@genreobj) {
>      push(@genres, [$g->id, $g->name]);
>    }
>    my $select = $form->get_element({name => 'genres'});
>    $select->options(\@genres);

BTW, you could get rid of all that code to populate $select->options()
by making sure the appropriate Model is in your form stash, by setting
this in your cat application config:

    'Controller::HTML::FormFu':
      model_stash:
        schema: My

Then modifying the Select field in your form config:

    type: Select
    name: genres
    model_config:
        resultset: Genres

That will also have the benefit of populating the Select menu every
time the form's built - so if you add an AutoSet constraint to the
field, it'll check whether the user-submitted value was a valid
option, when you call $form->submitted_and_valid().

Carl



More information about the HTML-FormFu mailing list