Advertisement
cng

persistent form not being cleared

cng
Dec 11th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.66 KB | None | 0 0
  1. #CNG::Controller::Form::Booking
  2.  
  3. has "form" => (
  4.     is      => 'rw', isa => 'CNG::HTML::FormHandler::Form::Booking',
  5.     lazy    => 1,
  6.     builder => '_build_form',
  7. );
  8. sub _build_form {
  9.     my $self = shift;
  10.     return CNG::HTML::FormHandler::Form::Booking->new(  );
  11. }
  12. sub get_form {
  13.     my $self = shift;
  14.     my $action = shift;
  15.     $self->form->clear;
  16.     $self->form->action($action) if $action;
  17.     return $self->form;
  18. }
  19.  
  20. sub start :Chained('base') :PathPart('booking') :Args(0) : GET {
  21.     my ($self, $c) = @_;
  22.     (my $form = $self->get_form())->process( schema => $c->model('DBIC')->schema );
  23.     $c->stash(
  24.         template => $self->templates->{create},
  25.         form     => $form,
  26.     );
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement