fieldsets & templates?

43 views
Skip to first unread message

Peter Bocz

unread,
Sep 9, 2011, 11:25:12 PM9/9/11
to perl-for...@googlegroups.com
Hi,

Is there a version still in the works that provides fieldset support via templates? I'd badly need this...

Peter

Wolfgang Radke

unread,
Sep 10, 2011, 2:54:07 AM9/10/11
to perl-for...@googlegroups.com
What exactly do you want to do?

Wolfgang

hesco

unread,
Sep 10, 2011, 3:39:08 AM9/10/11
to perl-for...@googlegroups.com
Peter:

Take a look at:
perldoc CGI::FormBuilder::Config::Simple

and see if that might work for you.

-- Hugh Esco
CampaignFoundations.com

Wolfgang Radke

unread,
Sep 10, 2011, 4:52:25 AM9/10/11
to perl-for...@googlegroups.com
hesco:
Peter wants functions usable in Templates. As to my knowledge there is no
way to handle fieldsets as part of the template interface of formbuilder.

Peter:
I always write my own templates , using only the primitives supplied by
formbuilder. That way I can handle fieldsets easily as part of the
template and have complete control as to which fields are positioned at
what spot.

If you have a neat idea how to use fieldsets automatically, please share
it.
Somebody might even implement it :-)

Wolfgang

Peter Bocz

unread,
Sep 10, 2011, 11:45:36 AM9/10/11
to perl-for...@googlegroups.com
Thanks for the responses. I'm sure CGI::FormBuilder::Config::Simple would do the trick, but it seems quite a different approach compared to my standard FB way of creating forms.
I also try to keep them simple, most of the time using only <TMPL_LOOP fields> with some headers/footer to let FB output its HTML tags in table layout (I use HTML::Template) and do some design customizations in CSS and jQuery.
If I supply a template file to FB, fieldsets are not generated in the tmpl_loop. If I let FB do its job entirely, fieldsets are OK, but I loose the elegant way of including headers (which provide most CSS and JS).
Ideally I would have FB's native output in a TMPL_VAR and wrap around it with my own template. It would be great it FB populate its native html into a special tmpl_var I could refer in my template.
Anyway, if there is no such thing, I'll do some workaround to include my headers in my perl code, but it's not very elegant since headers need to be maintained in 2 levels.

Peter

hesco

unread,
Sep 10, 2011, 12:52:03 PM9/10/11
to perl-formbuilder
Peter:

I suspect that 15 minutes running, examining and adapting the tests I
left in this
module might would show you some hope for accomplishing your goal
here.

Take a look at:
t/10-formbuilder.t

in the CGI::FormBuilder::Config::Simple package.

It is producing a fieldset. The configuration file has left the
template commented
out, but when we deployed this in a production environment, that was
not the case.
We had a template file (HTML::Template or tt2, can't remember, but I
use one of
those two from time to time).

The only thing this does is collapse the form building logic into an
ini file
(or whatever format you prefer which can be read by Config::Simple).

Once that is done, this call:

$self->render_web_form('signup_form',$debug_level)

renders your html (w/ js, css and whatever else you include in your
template).
It also handles the data validation work. All you have to do is write
any
methods to handle validation more complicated than a regex, plus the
code to process and store your incoming data.

You can have your fieldsets and templates too.

-- Hugh Esco
Reply all
Reply to author
Forward
0 new messages