That has been answered in this list many times before.

http://manual.cakephp.org/chapter/models

Look there for genrateList, pay attention to $keyPath/$valuePath,
study the examples.

You can also search this list.

Another way is to set $displayName in the model.


On Aug 13, 3:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> in model (kode_kab.php)
> i have script like this :
>
> ...
>
>  var $belongsTo = array ('KodeProv' => array(
>         'className' => 'KodeProv',
>         'conditions'=>'',
>         'order'=>'',
>         'foreignKey'=>'kode_kab_prov_id')
>     );
>
> ...
>
> and in model (kode_prov)
> ...
> var $hasMany = array ('KodeKab' =>
>                 array(
>         'className' => 'KodeKab',
>         'conditions'=>'',
>         'order'=>'',
>         'foreignKey'=>'kode_kab_prov_id')
>     );
> ...
>
> in controller
>
> function add() {
>
>                 if(empty($this->data)) {
>                         $this->set('provArray', 
> $this->KodeKab->KodeProv->generateList());
>                     $this->render();
>
>                 }
>         }
>
> in view (add.thtml)
> ...
>       <?php echo $html->selectTag('KodeKab/kode_kab_prov_id',
> $provArray, $html->tagValue('KodeKab/kode_kab_prov_id'), array());?>
> ...
>
> its work..
> but when i show print_r($provArray) the result is
> Array ( [1] => 1 [7] => 7 )
>
> i wont show like this
>
> Array ( [1] => text1 [7] => text7 )
>
> text1, text7 i get from table kode_provs
> the field is kode_prov_ket
>
> where i must change the code..
>
> thx


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to