[html-formfu] handling repeatable on the javascript side

Mario Minati mario.minati at googlemail.com
Sun Apr 26 10:49:54 GMT 2009


Am Sonntag 26 April 2009 10:09:27 schrieb Carl Franks:
> 2009/4/25 Mario Minati <mario.minati at googlemail.com>:
> >> Hi Carl,
> >>
> >> is a Repeatable without a nested name possible, maybe for radios or
> >> checkboxes?
> >
> > Actually I found this problem in 't/elements/block_repeatable_inc.yml'.
> > The old implementation produced:
> >
> > <form action="" method="post">
> > <fieldset>
> > <div>
> > <div class="text">
> > <input name="foo_1" type="text" />
> > </div>
> > <div class="text">
> > <input name="bar_1" type="text" />
> > </div>
> > </div>
> > <div>
> > <div class="text">
> > <input name="foo_2" type="text" />
> > </div>
> > <div class="text">
> > <input name="bar_2" type="text" />
> > </div>
> > </div>
> > <div class="submit">
> > <input name="submit" type="submit" />
> > </div>
> > </fieldset>
> > </form>
> >
> > The one returns:
> > <form action="" method="post">
> > <fieldset>
> > <div>
> > <div class="text">
> > <input name="_1.foo" type="text" />
> > </div>
> > <div class="text">
> > <input name="_1.bar" type="text" />
> > </div>
> > </div>
> > <div>
> > <div class="text">
> > <input name="_2.foo" type="text" />
> > </div>
> > <div class="text">
> > <input name="_2.bar" type="text" />
> > </div>
> > </div>
> > <div class="submit">
> > <input name="submit" type="submit" />
> > </div>
> > </fieldset>
> > </form>
> >
> > To resolve this problem I can think of some solutions:
> > a) Croak without a nested_name for Repeatable
> > b) Use old implementation (nested.foo_1) if no nested_name is given
> > c) Autocreate a nested_name if non is given
>
> I think probably b)
>  - so that it doesn't change behaviour unnecessarily

I will than use a function to switch the algorithm to use.

Greets,

Mario



More information about the HTML-FormFu mailing list