Hi,
I've just joined the list, but wondered if anyone, including Leanan, resolved the issue in their email from March:
http://lists.scsys.co.uk/pipermail/html-formfu/2009-March/001852.html

I just ask because I seem to be having the identical problem..
I have a classic many-to-many relationship, but can't get this to work as per the documentation.

Example:

table books (id, title)
.. ->has_many(book_genres => 'BookGenres', 'book')
.. ->man_to_many(genres => 'book_genres', 'genre')

table genres (id, name)
.. ->has_many(book_genres => 'BookGenres', 'genre')
.. ->many_to_many(books => 'book_genres', 'book')

table book_genres (book, genre);
.. ->belongs_to(book => books)
.. ->belongs_to(genre => genres)

So the formfu definition for a book should be:

elements:
 - name: title
   type: Text
 - type: Checkboxgroup
   name: genres


However in practice that doesn't work.. After some experimentation, I ended up with the following:

elements:
 - name: title
   type: Text
 - type: Checkboxgroup
   name: genres
   model_config:
     default_column: 'me.id'
     resultset: Genres

This at least renders the form, and populates the options that are available. However the current options are not pre-set, nor are changes saved to the database.

I'm probably doing something wrong, but wondered if you could help me figure out what! I've been banging my head against this for ages.

Thanks,
Toby

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

Reply via email to