
rod.taylor at gmail
Aug 26, 2008, 7:30 AM
Post #1 of 2
(356 views)
Permalink
|
|
FormFu / FormBuilder + Custom Actions
|
|
Both FormFu and FormBuilder controller "Actions" appear to have issues with their special variables disappearing when using an additional ActionClass. Below is a FormFu example. Carl asked me to repost it here for discussion. 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." use parent qw{Catalyst::Controller::HTML::FormFu}; ... 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'); return $self; } 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, Rod _______________________________________________ List: Catalyst[at]lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
|