Hi, check my entries in the threads below and see if they help. It looks as though you have the format for HABTM fields slightly wrong. For multiple checkboxes you need to construct the HTML yourself - the HTML helper doesn't have a function that will automate this.
http://groups.google.com/group/cake-php/browse_thread/thread/bea4e4a2e00c5cb6/cb1fbea80878792c#cb1fbea80878792c http://groups.google.com/group/cake-php/browse_thread/thread/3faf99103b090624/034922ffa4158f88#034922ffa4158f88 - ad codecowboy wrote: > I am creating a form that has multiple checkboxes. The basic ideas is > to allow users to select multiple foods that they like. Each food that > they like is stored in the same table but in a different row. > > The foods are categorized. For instance, once the user checks the > fruits checkbox, an ajax function is called that displays all of the > fruit choices. The user can then check bannanas, apples etc... > > In the controller, I have no way of determining which checkboxes that > they selected, because cake expects you to name the inputs like > '/foods/name'. > > In summary > (1) I am currently using this syntax to output each checkbox inside of > a loop : > echo ($html->checkbox('Food/name/' . $next_indentation_id . '/' > . $id, null, > array('id'=>$id, 'value'=>$id, 'onchange'=>$ajaxFunction))); > What syntax should I use to display each checkbox? NOTE: id is unique. > > (2) How can I store data into multiple rows of the same database for > the same user in cake (each checked box should result in a new row)? I > know how to hack this and make it work but I am looking for a graceful > solution. > > Thank you --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
