[html-formfu] HTML::FormFu::Exception::Validator etc?

Andreas Marienborg omega at palle.net
Fri Mar 14 10:53:53 GMT 2008


I am trying to write some javascript validation, using serverside.  
Using load_config_file and lots of small config-files, I have gotten  
alot closer, but I was wondering if some of this might fit better in  
HTML::FormFu.

I need a way to serialize the Exception-objects into hash'es suitable  
for passing as JSON to the client. I could just oneshot this in my  
code, but perhaps it should be something more "standard"?

     if (my $errors = $form->get_errors({

     })) {
         # We have errors!
         my @err;
         foreach (@$errors) {
             $c->log->debug($_ . " ::: " . $_->name . " - " . $_- 
 >message) if $c->debug;
             push(@err, {
                 name => "" . $_->name,
                 message => "" . $_->message
             });
         }
         $c->stash->{api_errors} = \@err;
     }


This is what I do now, and as a first step I was wondering if the  
creation of a hash there could be replaced by a method-call on the  
objects for instance?

If I am the only one ever going to use it, theres no point of course


- andreas




More information about the HTML-FormFu mailing list