Creating 'select' listboxes using FormHelper in CakePHP
- by joec
I have two models Category and Point. The associations are defined as:
Category hasMany Point
Point belongsTo Category
I would like, when adding Points to my database, to be able to select the category it belongs to from a <select> box, along with the rest of the form data.
Where would i need to set the category list and how could i do it? And how would i produce the select box?
I assume it could be done with
$form->input('categorieslist',array('type'=>'select')); //categorieslist needs
//setting somewhere.
But i am fairly new to Cake and not done much with associations before.
Thanks.