> So the issue of validation of input fields and the possibility to give
> hints and select fields to the user caused me a lot of work until I
> found Data::FormValidator, which especially in v. 3.1 allows to write
> really compact code *and* to have one runmode for one thematic issue
> and put the validating code into another functional block - this means
> that the same runmode is called over and over until all input is
> valid.
> This makes the beginning of a runmode a very short thing like
>
> sub radlmap_start {
> my $self = shift;
> my ($q, $s, $tmpl) = $self->querysessiontemplate('radladr.html');
> my $result = Data::FormValidator->check( $q, $self->param('_profile') );
> my $tmpl_errs = $self->work_on_errors($result);
> if ($tmpl_errs) {
> $tmpl->param($q->Vars); # put query variables into template
> $tmpl->param($tmpl_errs); # and error messages and fields too
> return $tmpl->output;
> }
> ...
>
> where the HTML::Template looks like this
>
><td>
> <!-- tmpl_unless err_msg_start -->
> <input name=start size=40 value="%start%">
> <!-- tmpl_else -->
> <font color=red><!-- tmpl_var err_msg_start --></font><br>
> <!-- tmpl_var err_inp_start -->
> <!-- /tmpl_unless -->
></td>
>
> (stolen from Mark Stosbergs Data::FormValidator example. Thanks...)
Markus,
Did you happen to see CGI::Application::ValidateRM? It makes integrating
with Data::FormValidator even easier.
Like this:
my ($results,$err_page) = $self->check_rm('form_display','_form_profile');
return $err_page if $err_page;
There is a complete demo with sample code here:
http://mark.stosberg.com/dfv/
Perhaps that's what you already found. I'm glad DFV has been useful for
you. I'm currently working on polishing a couple of related utility
modules to make it even easier to use:
Data::FormValidator::Generator
- generate form profiles based on a SQL table
http://mark.stosberg.com/dfv/Data-FormValidator-Generator-0.02.tar.gz
Data::FormValidator::Util::HTML
- Add the "err_" tokens to your HTML for you.
http://mark.stosberg.com/dfv/HTML.pm
http://mark.stosberg.com/dfv/util.html
I'm thinking about putting these both into "Data::FormValidator::Util"
for release. Currently "::Generator" is Postgres specific. Soon I'll
rewrite it be a bit more portable.
In the slightly longer term I'm working on a sub-class
of CGI::Application that will pull all this together to make it faster
to mockup and develop complete "BREAD" web/db applications. (Browse,
Read, Edit, Add, Delete).
Now I'm off to the skatepark before it gets darker:
http://mark.stosberg.com/images/frontpage/random/hip_ollie_329.jpg
Mark
--
http://mark.stosberg.com/
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.