Hi Carl,
do you know Hash::Flatten? I use this in Model::HashRef to convert the
form data to a hash. I thought this might be a good thing for your
naming scheme too. It could convert a hash with arrayrefs to the
fieldnames. One thing to workaround though is that Hash::Flatten
starts with an index of 0, but this can either be patched in
Hash::Flatten or worked around in FormFu.
moritz
Am 26.04.2009 um 10:09 schrieb Carl Franks:
2009/4/25 Mario Minati <mario.min...@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
Carl
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu