[html-formfu] Best practice for multiple same forms

Carl Franks fireartist at gmail.com
Fri Nov 23 21:05:51 GMT 2007


On 23/11/2007, Bogdan Lucaciu <bogdan at wiz.ro> wrote:
> On Friday 23 November 2007 17:01:22 Carl Franks wrote:
> > If it's a single form with repeated similar parts, you could use the
> > new Repeatable block element.
>
> What do you think about adding some javascript support to that? Just show one
> div, and have a "+" button that creates yet another one and another one.

I've already created an element that does this using the dojo js
library - however, I can't seem to find it in trunk/HTML-FormFu-Dojo -
so I think it must be on my other machine, and I've forgotten to check
it in.
There's an example catalyst app in "examples/repeatable" - but
obviously it's not much use without the element class.

I put all the HTML-FormFu-Dojo stuff on hold, waiting for 1.0 to come
out - which was released recently - so I'll get back to it soon.

> And for editing entities, you should have a 'remove' checkbox for the existing
> ones and an extra empty Repeatable block for adding, with the '+' button for
> adding new ones.

The code I'm working on in branches/HTML-FormFu-Model-DBIC already
supports having a checkbox on each Repeatable block to do this. See:
http://html-formfu.googlecode.com/svn/branches/HTML-FormFu-Model-DBIC/t/save_to_model/has_many_repeatable_delete_true.t
http://html-formfu.googlecode.com/svn/branches/HTML-FormFu-Model-DBIC/t/save_to_model/has_many_repeatable_delete_true.yml

> What do you think? The javascript could be "optional", the + button could just
> make a post request that adds a new div if js is not wanted/supported in the
> browser

I did a lot of testing, and couldn't come up with a way to get it
working completely accessibly without javascript - so it javascript is
off, you don't get a "add" link/button at all.
Check the archives - I'm sure there was discussion about it.

Cheers,
Carl



More information about the HTML-FormFu mailing list