list - Cakephp 2.0 Dropdown Select -


after reading , applying suggested answer dropdown, still got no results in dropdown. im newbie , gives me headache solving problem. have client table associated belongsto client_group table. whatever code modifications made naming convention, cant still display client group' data dropdown list. please help! please help! in advance

create table `clients` (   `id` int unsigned auto_increment primary key,   `client_group_id` int ,   `client_package_id` int ,   `client_account_id` int ,   `name` varchar(40),   create table `client_groups` (   `id` integer not null auto_increment  primary key,   `name` varchar(50),       insert `client_groups` (`id`,`name`) values (1,'top company holdings');     insert `client_groups` (`id`,`name`) values (2,'cadiz group of companies');  in client model:      public $belongsto = array(          'clientgroup' => array(             'classname'    => 'clientgroup',             'foreignkey'   => 'client_group_id' ,             'fields'       =>   'name'              ),  client group model:      public $hasmany = array(               'client' => array(             'classname'     => 'client',             'foreignkey'    => 'client_group_id',             'order'         => 'client.name desc' ) 

in clients controller: $clientgroups= $this->client->clientgroup->find('list',array( 'type'=>'select', 'fields'=> array('id', 'name'), 'order' => array('name' => 'asc'))); $this->set(compact('clientgroups'));

in client add.ctp :     <?php echo $this->form->input('client_group_id',array( 'option'=>$clientgroups ,                  'type'=>'select', 'empty'=>'select group'));     ?> 

have tried setting variable using camel case? $clientgroups , 'clientgroups'? that's correct naming convention.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -