hum... Honnest I haven't had a look at the $html->checkboxesMultiple
yet but well.. here's how my apps do it;

I've extended the html helper as I've got quite a few 'custom'
functions. One of them I called checkboxGroup (and other one is
radioGroup, which I though looks better than a select box in some
cases)

The function behaves pretty much like the input one, so my views don't
have any more 'layout processing' to do. So I call it like this;
param1 is the association name, and $keywords the list of all keywords
an article could be assigned to (~100).

<?php echo $eoHtml->checkboxGroup('Keyword',$keywords); ?>

The signature for the method is ;

function checkboxGroup ($assocName, $items, $htmlAttributes = null,
$separator = null, $selected_label = null, $selected_key = null, $div
= true ) {

* @param string $assocName the name of the association Model. Used to
generate the proper input name.
* @param array $items collection of items to display (from
generatedList is fine).
* @param array $htmlAttributes to assign to the wrapping div
* @param string $separator to be inserted between every elements
(default is <br/>)
* @param string $selected_label attribute from a $item to use as a
label (default: name)
* @param string $selected_id attribute from the $item object to map
the selection to (default: id)
* @param bool $div wrap the whole thing in a div or not - same as the -
>submit behavior in 1.2+
* @return string html generated

Same as most other HtmlHelper method, the values (selected items) are
pulled out of the current data. The function then generates;

<div class="checklist">
<input type="check..."/><label for"...">label</label><br/>
<input type="check..."/><label for"...">label</label><br/>
</div>

The to make a nice look and feel, I use the css to give the checklist
div a fixed height and make the overflow scroll (auto). Looks like
this;
http://img341.imageshack.us/my.php?image=untitledes0.png

Hope this helps!

Seb

'
On Feb 23, 9:56 pm, "szeta" <[EMAIL PROTECTED]> wrote:
> Does anybody have an idea here?
>
> Every hint is appreciated. :-)
> Regards
> Ralph
>
> On 22 Feb., 10:23, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I'm using CakePHP now for a few months on a project and I really love
> > the framework.
> > It helped me to safe a lot of time!
>
> > But one thing, I always run into is, that it's not so easy to generate
> > comfortable checkboxes (e.g. for maintaining HABTM relations).
>
> > I tried e.g. $html->checkboxMultiple and it works, that's already much
> > better than the scroll-box baked by default.
>
> > But I'd like to give more Information to the related items (not only
> > the primary key, but also the name or something else..)
>
> > How do you handle this? Is there a method I have overseen?
>
> > Best wishes!
> > Ralph


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to