Sunday, October 3, 2010

Re: Change id for checkboxes

Yes, good idea.

By setting the 'div' property to 11, this actually wraps the
checkboxes in a div with a class set to '11', just like this:

<?php echo $form->input('Group',
array(
'label' => 'Group',
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(1 => 'Pilot', 2 => 'Medical', 3 =>
'Other'),
'div' => 11)
);
?>

and then after, accessing the class of a checkbox with jQuery is as
simple as : $.id = $(this).parent().parent().attr('class');

Thanks a lot Jack.


On Oct 3, 3:19 pm, Jack Timmons <codeac...@codeacula.com> wrote:
> On Sun, Oct 3, 2010 at 8:00 AM, thomaus <tho...@saimiris.com> wrote:
> > Hi Jack,
>
> > Thanks for your answer.
>
> > Ok then, but how do you set a class for the inputs?
>
> > If I do this :
>
> > <?php echo $form->input('Group',
> >        array(
> >        'label' => 'Group',
> >        'type' => 'select',
> >        'multiple' => 'checkbox',
> >        'options' => array(1 => 'Pilot', 2 => 'Medical', 3 =>
> > 'Other'),
> >        'class' => 11)
> > );
> > ?>
>
> > this doesn't change anything at all, I mean my checkboxes they are not
> > assigned "11" as a class.
>
> > Cheers!
>
> Magic, I would guess.
>
> Likely just another thing CakePHP doesn't do.
>
> I would suggest wrapping them in a special div, giving that div a
> class, and then using that as a way to single them out. May not be
> what you're aiming for, but it'll get them job done.
>
> --
> Jack Timmons
> @_Codeacula

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: