[html-formfu] handling repeatable on the javascript side

Carl Franks fireartist at gmail.com
Tue Apr 21 12:37:43 GMT 2009


2009/4/21 Mario Minati <mario.minati at googlemail.com>:
> Hi,
>
> I'm just working on the implementation of client side repeatable elements for
> ExtJS.
>
> What I stumbled about are more complex forms with repeatable repeatables or
> nested repeatable or repeatable nested or ...
>
> Currently I see no automatic way to determine on the client side if a given
> element name (e.g. inner.outer.name_1) is repeatable nested or nested
> repeatable, right?
>
> The solution the came first to my mind was to analyse the form elements to
> discover which is repeatable and which is only nested. But that will not work
> in ExtJS if you choose to display e. g. each repeatable elements in it's own
> tab (when using a tabpanel). And I didn't want to trade flexibilty
> automation.
>
> So I'm currently thinking of creating a picture of the repeatable and nested
> structure on the server side and sending this to the client, so the client
> can easily findout on how to build form and element names.
>
> What do you think of this?
>
> Can you think of any more elegant solution?
>
> And shall we put the code to generate that 'picture' of the form structure
> into generic formfu, a plugin or just into FF::ExtJS class?

That's certainly a viable solution.

However, I'd prefer it if the Repeatable munging of field names were
"fixed" so that, for example, a repeatable-repeatable wasn't
    foo.bar_1_1
but
    foo_1.bar_1

I think this would solve your dilemma of needing to differentiate
between repeatable + nested.

If you go down your proposed route though, if it's basically a
$form->json() method - I'd see no reason it couldn't be core.

Carl



More information about the HTML-FormFu mailing list