[html-formfu] Creating options in many_to_many_select

Carl Franks fireartist at gmail.com
Sun Dec 16 00:06:35 GMT 2007


On 15/12/2007, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
>
> It looks that the ->defaults_from_model method sets the default values
> but it does not create the full list of options.

> Is that a conscious omission - do you think users should fill in the
> options themselves or would you welcome a patch?

Yes, it's on purpose. defaults_from_model() is purely for default values.

There's currently experimental support in Element/_Group to populate
from dbic if you're using the cat controller.
This works for  Select, Radiogroup + Checkboxgroup, which all inherit
from _Group.

    - type: Select
      name: foo
      db:
        model: MyModel

See the source of _Group::process() for details.
If you don't explicitly set the value or label columns, it'll
automatically use the PK and the first text/varchar columns in the
table.

Carl



More information about the HTML-FormFu mailing list