[Catalyst] trouble with Catalyst::Controller::FormBuilder: form
does not render correctly (no fields)
Markus Holzer
holli.holzer at googlemail.com
Sun Apr 6 13:00:37 BST 2008
> Can you post your .fb, template and controller code so we can see what
> the problem might be?
>
> [stephen]
>
Of course, though all I did was trying the example from the pod, nothing
fancy.
code:
!file: Infocenter/lib/Controller/Akte.pm
package Infocenter::Controller::Akte;
use strict;
use warnings;
use base qw(Catalyst::Controller::FormBuilder);
# [snip]
sub anlegen : Local Form
{
my ( $self, $c ) = @_;
my $form = $self->formbuilder;
if ( $form->submitted ) {
if ( $form->validate ) {
#send mail
#forward thank you
return $c->response->body("VALID FORM");
}
else {
$c->stash->{ERROR} = "INVALID FORM";
$c->stash->{invalid_fields} = [ grep { !$_->validate }
$form->fields ];
}
}
}
1;
!file: Infocenter/root/forms/akte/anlegen.fb
name: books_edit
method: post
fields:
title:
label: Book Title
type: text
size: 40
required: 1
author:
label: Author's Name
type: text
size: 80
validate: NAME
required: 1
isbn:
label: ISBN#
type: text
size: 20
validate: /^(\d{10}|\d{13})$/
required: 1
desc:
label: Description
type: textarea
cols: 80
rows: 5
submit: Save New Book
More information about the Catalyst
mailing list