I have just started using GroceryCrud and am very impressed so far and have been able to get it to do what I want really quite easily. However I have come a little unstuck on one point.
I have 3 tables:
- item (item_id)
- item_categories (item_id, category_id)
- categories (category_id)
As you have probably already figured this structure is so that I can represent a many to many relationship between items and categories, with item_categories being the link table between the two.
When adding or editing an item I want to display checkboxes for each category (or multi-select, but checkboxes preferred)
On add/update I then want to write the selected categories (category_id, item_id) to the item_categories table.
From reading the documentation I think I probably want to be using callback_before_update and callback_before_insert to populate item_categories. The main bit I am stuck on is how to get the categories to display as checkboxes on the form.
Can anyone advise how I would go about this?