[html-formfu] handling repeatable on the javascript side

Mario Minati mario.minati at googlemail.com
Sat Apr 25 08:38:47 GMT 2009


Am Mittwoch 22 April 2009 08:50:16 schrieb Carl Franks:
> 2009/4/21 Mario Minati <mario.minati at googlemail.com>:
> > Am Dienstag 21 April 2009 14:37:43 schrieb Carl Franks:
> >> 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.
> >
> > This would be the most elegant solution and means rewriting the
> > nested_name handling.
> >
> > If you agree with that way, than I'm willing to dive into that task.
> >
> > Currently the code that changes the field names lives in Repeatable.pm in
> > the method repeat.
> > Actually I think changing that method to add '_$rep' to the nested_name
> > should do (roughly) the job.
> >
> > To do it correctly I would like to comment the repeat method very
> > intensive. Is that ok when commiting those comments?
> >
> > Shall make the behavior configurable to keep backwards compatibility?
>
> Yes - feel free to do it!
> Yes - comments are good :)
>
> Backwards compatibility? Unless someone pipes up that they already
> have client-side code depending on it - don't bother - it'll just make
> our code more complicated.


Hi Carl,

is a Repeatable without a nested name possible, maybe for radios or 
checkboxes?

Greets,

Mario Minati




More information about the HTML-FormFu mailing list