oups, I forgive a "Categorie" replacement. You must read "PharmaciesTurn" instead of "CategoriesTurn"
On 27 juil, 09:50, BenJsno <bench...@yahoo.fr> wrote: > Hello, > > ------ in your controller function (add or edit): > ... > $pharmacies = $this->Turn->Pharmacy->find('list'); > // FOR SELECTED CHECKBOX : (only in edit) > $options['joins'] = array( > array('table' => 'pharmacies_turns', > 'alias' => 'PharmaciesTurn', > 'type' => 'inner', > 'conditions' => array('CategoriesTurn.turn_id = Turn.id') > ), > array('table' => 'pharmacies', > 'alias' => 'Pharmacy', > 'type' => 'inner', > 'conditions' => array('PharmaciesTurn.pharmacy_id = > Pharmacy.id') > ) > ); > $options['fields'] = array('DISTINCT Turn.id'); > $options['conditions'] = array('Turn.id' => $id); > > $tmpSelected = $this->Turn->find('all', $options); > $selected = array(); > > if (!empty($tmpSelected)){ > foreach ($tmpSelected[0]['Pharmacy'] as $pharmacy){ > array_push($selected, $pharmacy['id']); > } > > } > > $this->set(compact('pharmacies','selected')); > ... > > ------ in your view : > ... > echo $this->Form->input('Pharmacy', > array('label'=>false,'type'=>'select','multiple'=>'checkbox','selected'=> > $selected)); > ... > > BenJsno > > On 25 juil, 20:10, eraonline <eraonline...@gmail.com> wrote: > > > > > > > > > Hello! I want to show in the view a list of checkbox of Pharmacies to > > assign to a Turn. > > > Example: > > > Turn: INPUT TEXT > > > Pharmacies: > > > CHKBOX1 > > CHKBOX2 > > CHKBOX3 > > > Can help me with this? > > Thanks! > > > eraonline -- 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php