Still no luck.
My view has <?php
echo $form->input('User',array('multiple'=>'checkbox',
'div'=>false, 'label'=>false));
?>
The input type is multiple checkboxes. I think that’s where the problem is
coming from. The html rendered is:
<div class="checkbox">
<input id="UserUser13" type="checkbox" value="13" checked="checked"
name="data[User][Artist][]"/>
<label class="selected" for="UserUser13">ColdPlay</label>
</div>
Would it be easier to do a foreach type setup? That way I can hardcode the
view the way I want with <label><input></label>
Thanks,
Dave
-----Original Message-----
From: Brendon Kozlowski [mailto:[email protected]]
Sent: March-06-09 12:32 PM
To: CakePHP
Subject: Re: Labels around inputs
If you insist on using the helper and HAVE to have the markup you list,
it'll be mostly a manual exercise in overriding default behavior. For a
project that I did, I did the following:
<label>Type of Report</label>
<?php
echo $form->input('type', array('type'=>'radio', 'options'=>array
('public'=>'Public Incident/Accident','staff'=>'Staff Accident'),
'legend'=>false, 'value'=>($this->data['Incident']['type'] ==
'staff') ? 'staff' : 'public'));
?>
This, however, kept the DIV surrounding the input intact, the label however
was manually added prior to the default DIV and input that CakePHP's form
helper produces. As I see you have the label set to false and it is still
supposedly displaying a label, that makes me believe you need to clear your
cache. If you also need to remove the DIV surrounding the INPUT so that it
surrounds EVERYTHING, then you'll also want to set 'div'=>false in the
options array, and manually add it back in.
So, to summarize:
1. Keep 'label'=>false in your options array 2. Add 'div'=>false to your
options array 3. Manually add in the DIV and LABEL markup for your input.
4. Clear your cache.
5. Refresh the page. :)
On Mar 5, 11:43 pm, "Dave Maharaj :: WidePixels.com"
<[email protected]> wrote:
> Does anyone know how I can put my inputs inside the label DIV?
>
> Right now the code rendered is:
>
> <div class="checkbox">
> <input id="UserUser13" type="checkbox" value="13" checked="checked"
> name="data[User][User][]"/>
> <label class="selected" for="UserUser13">Perfect</label> </div>
>
> from this in the view :
> <?php
> echo
> $form->input(User,array('multiple'=>'checkbox','label'=>false));
> ?>
>
> What I need is :
>
> <div class="checkbox">
> <label class="selected" for="UserUser13"> <input id="UserUser13"
> type="checkbox" value="13" checked="checked"
> name="data[User][User][]"/>Perfect
> </label>
> </div>
> I dont even care if the class=checkbox is there.
>
> Thnaks
>
> Dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---