hi every body,

i have a table 'Secteur' wich 'hasMany' 'metier',( and metier belongs
to one secteur)  the problem is when i want  to update 'metier', i
need to list

the id of the 'secteur' but i cant do it,

i tried to list the 'secteur' table from my controller but i cant put
it in a selectBox, the second problem is in updating, the submit
button take me to

the same action,

function edit_metier($id=null){

                //$this->Metier->id = $id;

                if (empty($this->data)) {
                        $this->data = $this->Metier->Secteur->read('',$id);

                        $secteurs=$this->Secteur->find('list');
                        $this->set('secteurs',$secteurs);
                } else{
                        if ($this->Metier->save($this->data['Metier']))
                         {
                                $this->flash('update succeded 
',array('controller'=> 'Admins',
'action'=>'gestion_metier'));
                         }else
                                $this->flash('updating 
impossible',array('controller'=>
'metiers', 'action'=>'edit_metier',$this->data['Metier']['id']));
                 }

        }

for the view :

<?
echo $this->Form->create('Metier');

echo $this->Form->input('Secteur.id', array('id' => 'secteur'));//,
$secteurs, null, null, false

echo $this->Form->input('Metier.name');

echo $this->Form->input('Metier.id',array('type'=>'hidden'));

echo $this->Form->end('valider la modification');
?>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to