That actually has recently been added (clarified) to the cookbook documentation. http://book.cakephp.org/revisions/view/9876/Automagic-Form-Elements "Besides the specific input options found below you can specify any html attribute (for instance onfocus). For more information on $options and $htmlAttributes see HTML Helper."
Thanks, grigri. ;) On Aug 12, 10:06 am, grigri <[email protected]> wrote: > Sure, it's (afaik) undocumented, but it can be done: > > <? > echo $form->create('Bacon'); > > $colours = array( > array('name' => 'Red', 'value' => '#F00', 'style' => 'background- > color: #F00'), > array('name' => 'Green', 'value' => '#0F0', 'style' => 'background- > color: #0F0'), > array('name' => 'Blue', 'value' => '#00F', 'style' => 'background- > color: #00F') > ); > > echo $form->input('colour', array('options' => $colours)); > > echo $form->end('Eggs'); > ?> > > That should do the trick! > > hth > grigri > > On Aug 12, 1:45 pm, DavidH <[email protected]> wrote: > > > > > Hi > > > Is there any way of passing style settings for each select option when > > using $form->select? > > > I've a drop down that allows users to choose a colour from a long > > list. It would be cool(ish) if the each option in the select had the > > background-color set to the actual colour. > > > Thanks > > > David- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
