-----Original Message-----
From: David Scott [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 10, 2004 1:26 AM
To: [EMAIL PROTECTED]
Subject: [cgiapp] CGI::FormBuilder -- cgiapp_postrun -- template default

> [...]
>  requested feedback on CGI::FormBuilder
>
> I haven't found any problems using CGI::FormBuilder
> with CGI::Application.  I use it all the time.  When
> I finish a small application, I'll post a link to it.

Thanks for your feedback.

I don't know if "problems" [with CGI::FormBuilder] is the right word, I
just meant that in some situations you have to write some extra code
(few lines really) to make CGI::FB work along with CGI::A the way you
want.

The problem is that CGI::FB insists in generating the /whole/ HTML page
(possibly including headers,) rather than just the <form>...</form> HTML
code portion. OK, you can disable headers generation (header=>0,) but
you still have javascript code inserted into the <head>...</head>
section, the <body> tags etc. (The javascript code placement into the
head section is correct, I'm not discussing about it.)

So the point is, if you are using CGI::FB as a /backend/ module from
your CGI::A application, and you use it also to render the form and you
want also javascript code generation (that is one of the main reasons I
was looking at CGI::FB,) and you still want to keep the possibility to
add/modify the HTML code from your CGI::A application before sending it
to the web server, you have to mangle in some way the text returned by
CGI::FB, since it represents something more similar to the whole page
(including <head> and <body> and possibly headers) rather than just the
pair of strings containing the <form> and <script> HTML fragments you
could straight slap into your template (from inside your CGI::A
application.)

Needing also some extra flexibility in page and forms generation, the
solution I eventually adopted is using (the same) H::T template both in
my CGI::A code and in CGI::FB, this way:
roughly speaking, I use a single H::T template containing both the TMPL
tags pertaining to the C::A app and the TMPL tags pertaining to CGI::FB;
I let CGI::FB load the template (from file) and expand just its TMPL
tags, then from within my C::A application I load (from text ref) the
/half-expanded/ template (returned as a string by CGI::FB,) where I
expand the remaining TMPL tags and/or add headers etc. and finally I
send the full-interpolated document to the web server.

This way I force CGI::FB, in a sense, to generate only what I want, that
is distinct <form> and <script> HTML fragments.

Anyway I can eventually give up generating forms and resort to use
something else just to validate them, as CGI::FB built-in form rendering
is not completely satisfactory to me, so I essentially have to design
the form by myself (through an H::T template.)
Data::FormValidator would be perfect, if it only generated also
javascript validation code.
Like CGI::FB, CGI::Ex does both server-side (Perl) validation and
client-side javascript validation, but I haven't tested yet how easily
it integrates with CGI::A (it seems that it rather tries to replace it
with CGI::Ex::App.)

Any comments?

Cheers,
Emanuele.



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to