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

Carl Franks fireartist at gmail.com
Mon Apr 30 19:44:22 GMT 2007


On 30/04/07, Jason Kohles <email at jasonkohles.com> wrote:
> 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?

form_error_message only sets the message that should be used - I
imagine it usually being set to a localisation string in your config
file, so it needn't change at run time.
I think we need a new method which forces the error message to be
rendered, even if there are no field-errors.
Could you add a RFE to the issue tracker, for this?
http://code.google.com/p/html-formfu/issues/list

Carl



More information about the Html-widget mailing list