Hello,

I am new to the Catalyst framework and am getting used to it.
I have read through Catalyst::Controller::FormBuilder manual at CPAN and
Tried to use the form builder, but even simpliest things from examples do not 
work.

Could you, please, explain if I am doing something wrong?

I have written the following controller:

---cut---
package MyApp::Controller::CardViewer;

use strict;
use warnings;
use base 'Catalyst::Controller::FormBuilder';

sub view : Local Form {
   my ( $self, $c ) = @_;
   
   $c->stash->{'template'} ||= 'cardform.tt';
   my $form = $self->formbuilder;
   
   $form->field( name => 'CardID' );

   if ( $form->submitted ) {
      if ( $form->validate ) {
         return $c->response->body("VALID FORM");
      } else {
         $c->stash->{'error'} = "INVALID FORM";
         $c->stash->{'invalid_fields'} = [ grep { !$_->validate } $form->fields 
];
      }
   }
}
---cut---

It uses C::C::FB as a base class and everything seems to be installed including 
latest CGI::FormBuilder,
But when I point my browser to that controller, Catalyst shows the following 
error:

Caught exception in MyApp::Controller::CardViewer->view "Can't call method 
"field" on an undefined value at 
c:/apache2.2/htdocs/myapp/lib/MyApp/Controller/CardViewer.pm line 51."

It seems that $self->formbuilder returns undef.
Is it possible to debug this situation?
Yes, the file root/forms/cardviewer/view.fb exists and changed from example.


Thank you in advance,

   Denis Frolov

Perl developer
Fotki Inc OU
http://www.fotki.com/




_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to