usually you dont pass the dummy field via controller
there is an empty field param for it
echo $this->Form->input('category_id', array('options'=>$cats,
'empty=>'dummyName');
or
echo $this->Form->input('category_id', array('options'=>$cats,
'empty=>array('dummyFieldValue'=>'dummyName')));
On 15 Jun., 17:35, leo <[email protected]> wrote:
> You might also want to do this if you want to specify which fields to
> return:
> $this->set('categories', $this->Item->Category-
>
> >find('list',array('fields'=>array('id','other_name'));
>
> If you need to add a dummy field, try:
> $categories = array(0=>'unassigned') +
> $this->Item->Category->find('list',array('fields'=>array('id','other_name'));
>
> $this->set('categories', $categories);
>
> And in the view, if your categories aren't appearing (because the
> naming is different) try:
> echo $this->Form->input('category_id',array('options'=>$cats));
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" 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?hl=en