[html-formfu] many-to-many with a map table and HTML::FormFu::Model::DBIC

Justin W scsys.co.uk at datademons.com
Fri Nov 20 15:31:18 GMT 2009


> It should be as simple as naming the Checkboxgroup after the
> many-to-many relationship.
>
> If that doesn't work, can you post your schema code and form config?
>
> Oh, and what part isn't working: default_values() or update() ?

OK, my classes are pretty simple.  (I simplified in my original e-mail.)

I have:

volunteers
  -> has_many volunteer_job_types
  -> many_to_many job_types

job_types
  -> has_many volunteer_job_types
  -> many_to_many volunteers

volunteer_job_types
   -> belongs_to job_type
   -> belongs_to volunteer

I want a series of checkboxes that let me add/set/remove job types for volunteers.

Here is my YML:

     - type: Checkboxgroup
       label: 'Job Types'
       name: job_types
       model_config:
         resultset: JobTypes
         model: JobTypes
         label_column: description

The form displays the checkboxes correctly, and even saves them correctly when
I change them.  It does not set the ones that are currently set as checked by
default.

HTML::FormFu 0.05001
HTML::FormFu::Model::DBIC 0.05002

Justin



More information about the HTML-FormFu mailing list