addGroup multiple embedNext

1. about a year ago

Registered: 2012-12-20
Posts: 2

addGroup multiple embedNext

How do you embed multiple groups after one another inside a parent group? EmbedNext seems insufficient for this.

     ->setOption('embedNext', true);

     $form->addGroup('Child One');

     $form->addGroup('Child Two');

This leaves Child Two outside the Parent and adding an embedNext to Child One puts Child Two inside Child One which isn't what I'm after. So is this possible in some way that I'm missing? It would be nice to be able to add Groups to Containers or something.

Edit: Another possibility for my situation would be to be able to add a fieldset wrapper to a Container!

Last edited by BryceBubbles (2012-12-20 22:31)


2. about a year ago

Registered: 2012-12-20
Posts: 2

Re: addGroup multiple embedNext

It's been almost a month now since I asked this question, so I guess the English forum isn't very active!?

Anyway, I found a solution in the Czech forum (Google Translate!).

The 4th post of that link has code for a custom form render. So I just made a copy of the DefaultFormRenderer (and changed its class name of course) and replaced the renderBody function with the one from the above link. Then by setting your form to use the new renderer you can use embedNext with a Number rather than just a Boolean, like this:

$form->setRenderer(new YourNewRenderer);
     ->setOption('embedNext', 2);

This will embed the next 2 groups into this parent group!

I also found this page on rendering very helpful. It's also in Czech, but I found Google's translation ok to follow. Could the English Forms Docs be updated with this stuff perhaps? Nested Toggle, Shared Toggle etc.

And could someone let me know if the above solution has been add to the distribution?
I'm using Forms as standalone.

Last edited by BryceBubbles (2013-01-17 00:12)


3. about a year ago

Registered: 2007-03-11
Location: Brno
Posts: 1303

Re: addGroup multiple embedNext

Unfortunately as you can see, the mentioned page is at dev subdomain, so it's not official released documentation page. But you are right, the English documentation or forum sucks! :(


Board footer

Switch to desktop