Creating 'select' listboxes using FormHelper in CakePHP
Posted
by joec
on Stack Overflow
See other posts from Stack Overflow
or by joec
Published on 2010-04-17T13:04:50Z
Indexed on
2010/04/17
13:23 UTC
Read the original article
Hit count: 268
cakephp
|formhelper
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.
© Stack Overflow or respective owner