1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
   |  
class Application_Form_Accueil extends Zend_Form
{
 
    public function init()
    {
        $this->setName('Accueil');
        $this->setMethod('post');
        $this->setAttrib('accept-charset', 'utf-8');
 
        // listing des directions
        $dbDirection = new Application_Model_DbTable_Directions();
        $result = $dbDirection->fetchAll()->toArray();
        $options = array();
        foreach ($result as $value) {
             $options[$value['idDirection']] = $value['libDirection'];
        }
        $this->addElement('select','direction',array('label' => 'Sélectionner votre direction :',
                                                     'onChange' => 'javascript:location.reload();',
                                                     'MultiOptions'=>$options));
 
        // listing des services
        $dbService = new Application_Model_DbTable_Services();
        $result1 = $dbService->selectServicesDirection(C'est ici que j'aimerai récupérer la valeur du select précédent "direction" )->toArray();
        $options1 = array();
        foreach ($result1 as $value1) {
             $options1[$value1['idService']] = $value1['libService'];
        }
 
        $this->addElement('select','service',array( 'label' => 'Sélectionner votre service :',
                                                    'MultiOptions'=>$options1));
 
        $this->addElement('submit','Valider');
 
        }
} | 
Partager