Oh, forgot one little thing. This code:

`if (isset($document_categories) && count($document_categories) > 0)`

can be replaced with this code:

`if (!empty($document_categories))`

It does exactly the same thing [for an array, anyway] and is shorter
and neater [just personal preference].

hth
grigri

On Jan 8, 1:33 pm, grigri <[email protected]> wrote:
> Ok, here's a few things to help you:
>
> First, that view function of yours belongs in a helper. You should
> never define functions inside a view template.
>
> From an HTML point of view, there are 2 ways of defining label/input
> relationships. You can either embed the input inside the label, which
> makes the relationship obvious, or declare a unique ID for the input,
> which is referenced by the label using the `for` attribute. This id
> must be unique throughout the page. The most usual approach is the
> second one.
>
> For the data to be sent and received properly to/by cake, each radio
> element (`<input>`) must have a name attribute and a value attribute.
> In this case, all of the name attributes should be the same, and each
> value attribute should be set to the corresponding id of the category.
>
> Anyway, here's a helper for you:http://pastie.org/355620
>
> And here's sample usage with a dummy dataset:http://pastie.org/355621
>
> The output html is valid, neatly indented and should work fine with
> cake's data handling. I'm using the element id and `for` approach
> here, because the other way is too easy. (Plus I never use it because
> it wreaks havoc with my stylesheets)
>
> hth
> grigri
>
> On Jan 8, 5:09 am, "Jon Bennett" <[email protected]> wrote:
>
> > Hi,
>
> > I have a category system, parent/child, which I'm trying to create a
> > nested group of radio inputs for.
>
> > So far I 
> > havehttp://pastie.org/355368whichoutputshttp://pastie.org/355369-if anyone 
> > has experience of working with
> > this type of dataset and could offer some advice I'd appreciate it.
>
> > BTW it doesn't use the tree behaviour, I had issues with
> > auto-populating the data in one go, as there's 405 categories, for
> > some reason I got quite a few errors which screwed the tree and no
> > matter what i tried it was irretree-vial ;)
>
> > Thanks,
>
> > Jon
>
> > --
>
> > jon bennett
> > w:http://www.jben.net/
> > iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to