In case anyone ran into this, I fixed this like so:
Index: libs/view/helpers/form.php
===================================================================
--- libs/view/helpers/form.php (revision 149)
+++ libs/view/helpers/form.php (working copy)
@@ -1491,12 +1491,14 @@
$options = array_reverse($options, true);
}
+ $extra_attributes = ($style === 'checkbox' &&
isset($attributes['separator'])) ? array('separator' =>
$attributes['separator']) : array();
+
$select = array_merge($select, $this->__selectOptions(
array_reverse($options, true),
$selected,
array(),
$showParents,
- array('escape' => $escapeOptions, 'style' =>
$style, 'name' => $attributes['name'])
+ array_merge($extra_attributes, array('escape'
=> $escapeOptions, 'style' => $style, 'name' => $attributes['name']))
));
$template = ($style == 'checkbox') ?
'checkboxmultipleend' : 'selectend';
@@ -1984,6 +1986,8 @@
$selectedIsEmpty = ($selected === '' || $selected === null);
$selectedIsArray = is_array($selected);
+ $separator = (isset($attributes['separator'])) ?
$attributes['separator']: Null;
+
foreach ($elements as $name => $title) {
$htmlOptions = array();
if (is_array($title) &&
(!isset($title['name']) || !isset($title['value']))) {
@@ -2052,7 +2056,10 @@
$this->Html->tags['checkboxmultiple'], $name,
$this->_parseAttributes($htmlOptions)
);
- $select[] =
$this->Html->div($attributes['class'], $item . $label);
+ if ($separator)
+ $select[] = $separator.$item.$title;
+ else
+ $select[] =
$this->Html->div($attributes['class'], $item . $label);
On Fri, Apr 15, 2011 at 2:44 PM, Yuka Poppe <[email protected]> wrote:
> Hi Folks,
>
> I'm trying to use multiple-select checkboxes to display a few options
> in my forms, however, they do not conform to either $option['div'] =
> False nor $option['div'] = 'custom-class' nor $option['separator']
> = ...
>
> The helper simply keeps wrapping the checkboxes in div's with class
> checkbox. I'm expecting it to not wrap the individual checkboxes in
> div's, and utilizing the $options 'separator', 'before' and 'after' to
> wrap the boxes in label tags.
>
> Allthough I understand this might be a common use case in certain
> situation, maybe its a nice idea to not assume things like this.
> Especially since all the other form inputs do conform to above
> mentioned methods.
>
>
> There was a ticket posted a while back, at
> http://cakephp.lighthouseapp.com/projects/42648/tickets/1202
>
> Its now marked as resolved, however it only fixes half the problem --
> it only fixes the part where you can change the classname of the
> wrapped div's, but its still impossible to simply get rid of the div's
> all by itself.
>
> Is there anyone out there that has a trivial way to work around this?
> Am i missing something? Besides doing the obvious and patching the
> helper myself or manually setting up the checkboxes and thus having to
> patch/deal with the Security component and form validation and
> whatnot?
>
> Regards, Yuka
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php