[html-formfu] FormFu + Other Actions

Rod Taylor rod.taylor at gmail.com
Sat Aug 23 04:07:19 BST 2008


Having a problem using FormFu $c->stash->{'form'} variable not being
set via FormConfig when using an additional action class. FormBuilder
has a similar issue.

[2008/08/22 23:02:23] [catalyst] [ERROR] Caught exception in
SK::Controller::Client->edit "Can't call method "get_field" on an
undefined value at
/usr/home/rbt/work/sk/SK/script/../lib/SK/Controller/Client.pm line
284."

sub edit : Local FormConfig ActionClass('+SK::Action::Test) {
    my ( $self, $c, $clientName ) = @_;

    my $form = $c->stash->{'form'};

    my $field = $form->get_field(name => 'some_field');
    $field->default('Default Value');
}


Any ActionClass will break it, including one virtually empty as found
in the Catalyst documentation:


package SK::Action::Test;

use strict;
use warnings;
use version 0.74;
our $VERSION = version->new(qw$Revision: 162 $);

use Class::C3;
use base 'Catalyst::Action';

sub execute {
      my $self = shift;
      my ($controller, $c, @args) = @_;

      # put your 'before' code here

      my $r = $self->next::method(@_);

      # put your 'after' code here

      return $r;
}

1;
__END__



Thanks in advance for your help!

- Rod



More information about the HTML-FormFu mailing list