On Apr 11, 10:40 pm, "#2Will" <[email protected]> wrote:
> Hi bakers
>
> I'm creating a habtm list of checkboxes like this:
>
> echo $form->input('User', array('multiple'=>'checkbox', 'label'=>''));
>
> which works brilliantly. Now i'd like to enhance it by adding a
> class name to each input based on the user group. Is that possible
> whilst still using the automagical method? maybe somthing along the
> lines of 'class' => 'User.group' ?
echo $form->input('User', array('multiple'=>'checkbox', 'label'=>'',
'class' => 'Whatever'));
In fact, you can only do this with input(). For some reason,
checkbox() has no $htmlAttributes param.
> I'd probably also like to have the labels read
>
> Jo Blogs ([email protected])
>
> as well, is that best handled by manualy creating the list in the
> controller to make the label like that? even if the bit in brackets is
> a bit grey? its slightly viewish for that, but i can't see how else to
> do it.
I don't think there's any way to do it with find('list') alone. I
think you'd have to do a find('all') and then use something like
Set::extract() to get an array that's useful for your options.
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
To unsubscribe, reply using "remove me" as the subject.