Could it be the space? Try replacing them both in the options array and the value you are trying to match (tacky I know, but at least it would isolate the problem).
Jeremy Burns [email protected] On 30 Apr 2010, at 16:12, Andrei Mita wrote: > I have added the model and there is no change. > > I have noticed that if I do the options like 'G1' => 'Generatia 1' and so on, > it works. > > > The debug on $options: > > Array > ( > [Generatia 1] => Generatia 1 > [Generatia 2] => Generatia 2 > [Generatia 3] => Generatia 3 > [Mesteri] => Mesteri > ) > > > > > > On Fri, Apr 30, 2010 at 6:07 PM, Jeremy Burns <[email protected]> wrote: > What about: > > $form->select('Profile.group', $options, array('selected' => > $this->data['Profile']['group'])); > > (in other words adding the model name to the select name) > > > Jeremy Burns > [email protected] > > > On 30 Apr 2010, at 16:04, Andrei Mita wrote: > >> I know, I fallowed the example but I'm missing something. >> >> >> On Fri, Apr 30, 2010 at 6:01 PM, Ed Propsner <[email protected]> wrote: >> I just tried this one and it works : >> >> $options=array('M'=>'Male','F'=>'Female'); >> echo $form->select('gender',$options, array('selected' => 'M')); >> >> On Fri, Apr 30, 2010 at 11:00 AM, Andrei Mita <[email protected]> wrote: >> It doesn't work :(( >> >> >> >> On Fri, Apr 30, 2010 at 5:58 PM, Andrei Mita <[email protected]> wrote: >> I've tried that. I'll try it again. If it works, I'm calling it a day :) >> >> >> >> On Fri, Apr 30, 2010 at 5:53 PM, Ed Propsner <[email protected]> wrote: >> Try this. I'm "almost" sure it will work 8-) >> >> $form->select('group', $options, array('selected' => >> $this->data['Profile']['group'])); >> >> On Fri, Apr 30, 2010 at 10:17 AM, Andrei Mita <[email protected]> wrote: >> Hello, >> >> I'm making an edit form and I can't get the existing value to be selected >> into one of the select field. >> >> The classic input in the view: echo $form->input('group'); >> >> I've changed that to a select: >> >> $options=array('Generatia 1'=>'Generatia 1','Generatia 2'=>'Generatia 2', >> 'Generatia 3'=>'Generatia 3'); >> echo $form->select('group',$options); >> >> The existing value is in $this->data['Profile']['group'] and, in my example, >> is equal to "Generatia 2" >> >> How can I make that one selected? >> >> echo $form->select('group',$options, $this->data['Profile']['group']), as >> shown in the book, doesn't work. What am I missing? >> >> Thanks >> >> >> >> Toate cele bune, >> Andrei Mita >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" 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 >> >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" 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 >> >> >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" 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 >> >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" 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 >> >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> You received this message because you are subscribed to the Google Groups >> "CakePHP" 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 > > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" 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 > > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" 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 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" 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
