[Html-widget] FormFu: form_error_message not an error?

Jason Kohles email at jasonkohles.com
Mon Apr 30 17:37:57 GMT 2007


It seems that setting form_error_message on a form that has no other  
errors will not have any effect.  Is this the intended behavior, and  
if so does anyone else think it doesn't make sense?  :)  In  
particular, I was trying to use form_error_message as a kind of  
'error-handler of last resort', by doing this in a Catalyst app:

if ( $form->submitted_and_valid ) {
     my $user = $c->model( 'DB::User' )->new( {} );
     eval { $user->populate_from_formfu( $form ) };
     if ( $@ ) {
         $c->log->error( $@ );
         $form->form_error_message( "FATAL ERROR: $@" );
     } else {
         $c->post_redirect( '/thank_you' );
     }
}

Does it seem like this should work, or does anyone have a suggestion  
for a better way to handle this?

-- 
Jason Kohles
email at jasonkohles.com
http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire





More information about the Html-widget mailing list