Saturday, May 1, 2010

Re: Selected option in select

Why are we not using (and I have tested this using 1.2.6)?

$form->input('Profile.group', array('options'=>$groups));

Where $groups is the options array relating to the Profile.group
field, the fact you supply an options array tells the form helper to
automatically create a select list.

If $this->data['Profile']['group'] is set in the controller (either
manually or from a Model->find call) the form helper will
automatically select it if the value matches a key in your $groups
array.

HTH

Paul

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: