1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
package TestApp::Controller::Basic;
use strict;
use warnings;
use base 'Catalyst::Controller::HTML::FormFu';
sub basic : Chained : CaptureArgs(0) {
my ( $self, $c ) = @_;
$c->stash->{template} = 'form.tt';
}
sub form : Chained('basic') : Args(0) : Form {
my ( $self, $c ) = @_;
my $form = $c->stash->{form};
$form->element( { name => 'basic_form' } );
}
sub formconfig : Chained('basic') : Args(0) : FormConfig { }
sub formconfig_FORM_NOT_SUBMITTED {
my ( $self, $c ) = @_;
push @{ $c->stash->{message} }, 'not submitted';
}
sub formconfig_FORM_SUBMITTED {
my ( $self, $c ) = @_;
push @{ $c->stash->{message} }, 'submitted';
}
sub formconfig_FORM_NOT_VALID {
my ( $self, $c ) = @_;
push @{ $c->stash->{message} }, 'not valid';
}
sub formconfig_FORM_VALID {
my ( $self, $c ) = @_;
push @{ $c->stash->{message} }, 'valid';
}
sub formconfig_FORM_RENDER {
my ( $self, $c ) = @_;
push @{ $c->stash->{message} }, 'render';
}
sub formconfig_conf_ext : Chained('basic') : Args(0) : FormConfig('basic/formconfig_conf_ext') {
}
sub formmethod : Chained('basic') : Args(0) : FormMethod('_load_form') {
}
sub _load_form : Private {
return { element => { name => 'basic_formmethod', } };
}
1;
|