3.7.8.5 displayField

The displayField attribute specifies which database field should be used as a label for the record. The label is used in scaffolding and in find('list') calls. The model will use name or title, by default.

For example, to use the username field:

class Example extends AppModel {
   var $displayField = 'username';
}
  1. class Example extends AppModel {
  2. var $displayField = 'username';
  3. }

Multiple field names cannot be combined into a single display field. For example, you cannot specify, array('first_name', 'last_name') as the display field.