[dev] Template or RENDERER for dynamic forms?

Robin Rainton robin at rainton.com
Tue Dec 6 20:58:38 PST 2005


Hi again,

Thx to Jan for answering my last query on where to stash data... and for my next
quandry: forms.

I need to have a form that 'grows'. I was going to do it with Javascript if
possible as this will simply be the same inputs repeated as many times as the
user requires. Ie. they hit 'Add Requirement' and the small part of the form
that stores what a 'requirement' is duplicated. All the inputs (3 or 4 I think)
will have a number at the end, the javascript will duplicate these inputs and
increment the number. Should be easy to stash these in the DB accordingly when
submitted.

Erm... to complicate this more, that part should, itself be within another
section that can be duplicated but don't worry about that.

Anyhow, point is that I see there are two different approaches in existing apps
to this:

Ingo uses a form built with a template to achieve something similar, which is
OK, but I like the idea of using the form renderer more (erm - think whups
sortof does this with it's ticket submission). But can one stash Javascript
easily into the form renderer and is it flexible enough for what I want?

Have played with the render and it is indeed very nice (I can make use of the
monthDayYear input for example) so would rather go that way. However I see this
hidden "formvars" input and suspect if I put JS in the code that will become
broken. I don't really want to resort to the user hitting a button, which
submits the form and re-displays with a new section each time, it would be
rather slow (this is what both the apps I mention do, BTW so I'm guessing it's
the only way).

Sorry to be such a newbie, but if something is worth doing, worth doing right
and all.

Robin



More information about the dev mailing list