Cakephp selection list showing identifiers instead of text

I use cakephp 1.3 to create a form, I create a selection list using hasOne and belongs to the relation

my models: image, category

category hasMany image

image belongs to the category

Category table

has two columns id and category_name

I do

$this->set('categories', 
           $this->Image->Category->find(
                                        'list',
                                         array( 'order' => 'category_name ASC' )
                                       )
          ); //to generate the select list

there is only one problem so far, the selection list just created shows the category identifier instead of category_name as option text, I know this is not cakePHP error, but I need to know the solution

any help please.

PS, if I am unclear in the question, please let me know

+5
source share
2 answers

displayField , CakePHP , . :

var $displayField = 'category_name';

category_name 'name' 'title' ( , , "name" ).

+6

:

3.7.3.1.4 find ('list')

find ('list') , , , , . , ( displayField).

+2

All Articles