set the selected value in dropdown
HI i have a form with dropdown for selecting the industry which i have populated. but in the modify form, i need to set the selected value which is come from the database. this is the code that i have written in the view ?php echo $form-select('industry',array($industry),*$industry*,array(),'Select Industry'); ? array($industry) - list of values which is displaying in the drop down how do i go about setting the value in the dropdown. $form-select( $fieldName, $options = array ( ), $selected =NULL, $attributes = array ( ), $showEmpty = '' ) -- Regards Pradheep Ayyanar [PraDz] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: set the selected value in dropdown
Just set $this-data in controller to record data you will modify and Cake will set 'selected' and other values itself. On Jul 21, 1:50 pm, Pradheep Ayyanar mapradh...@gmail.com wrote: HI i have a form with dropdown for selecting the industry which i have populated. but in the modify form, i need to set the selected value which is come from the database. this is the code that i have written in the view ?php echo $form-select('industry',array($industry),*$industry*,array(),'Select Industry'); ? array($industry) - list of values which is displaying in the drop down how do i go about setting the value in the dropdown. $form-select( $fieldName, $options = array ( ), $selected =NULL, $attributes = array ( ), $showEmpty = '' ) -- Regards Pradheep Ayyanar [PraDz] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---
Re: set the selected value in dropdown
thanks On Tue, Jul 21, 2009 at 12:52 PM, Dr. Loboto drlob...@gmail.com wrote: Just set $this-data in controller to record data you will modify and Cake will set 'selected' and other values itself. On Jul 21, 1:50 pm, Pradheep Ayyanar mapradh...@gmail.com wrote: HI i have a form with dropdown for selecting the industry which i have populated. but in the modify form, i need to set the selected value which is come from the database. this is the code that i have written in the view ?php echo $form-select('industry',array($industry),*$industry*,array(),'Select Industry'); ? array($industry) - list of values which is displaying in the drop down how do i go about setting the value in the dropdown. $form-select( $fieldName, $options = array ( ), $selected =NULL, $attributes = array ( ), $showEmpty = '' ) -- Regards Pradheep Ayyanar [PraDz] -- Regards Pradheep Ayyanar [PraDz] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com 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?hl=en -~--~~~~--~~--~--~---