FAQ
Fellow nerds,

I've got a problem with Catalyst::Controller::FormBuilder. I'm doing
exactly as advertised in the pod but the form refuses to render, or
better said is its fields.
The submit button is rendered with the correct caption (which is
different from "submit"), hence the .fb file is found and loaded. And
when i peek into $self->formbuilder->{fields} turns out the array is
there, but empty.
So the formbilder object is not correctly initialized, but I have no
idea why. I've tried some variations, like "Form(explicit/path) and
different line endings (cr, lf, crlf) of the .fb file. no avail.

i'd be grateful for suggestions.
thank you

Search Discussions

  • Stephen Sykes at Apr 6, 2008 at 12:32 am

    Markus Holzer wrote:
    Fellow nerds,

    I've got a problem with Catalyst::Controller::FormBuilder. I'm doing
    exactly as advertised in the pod but the form refuses to render, or
    better said is its fields.
    The submit button is rendered with the correct caption (which is
    different from "submit"), hence the .fb file is found and loaded. And
    when i peek into $self->formbuilder->{fields} turns out the array is
    there, but empty.
    So the formbilder object is not correctly initialized, but I have no
    idea why. I've tried some variations, like "Form(explicit/path) and
    different line endings (cr, lf, crlf) of the .fb file. no avail.

    i'd be grateful for suggestions.
    thank you

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    Can you post your .fb, template and controller code so we can see what
    the problem might be?

    [stephen]
  • Markus Holzer at Apr 6, 2008 at 1:00 pm

    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
  • Jon Schutz at Apr 6, 2008 at 1:34 pm

    On Sat, 2008-04-05 at 16:31 +0200, Markus Holzer wrote:
    Fellow nerds,

    I've got a problem with Catalyst::Controller::FormBuilder. I'm doing
    exactly as advertised in the pod but the form refuses to render, or
    better said is its fields.
    The submit button is rendered with the correct caption (which is
    different from "submit"), hence the .fb file is found and loaded. And
    when i peek into $self->formbuilder->{fields} turns out the array is
    there, but empty.
    So the formbilder object is not correctly initialized, but I have no
    idea why. I've tried some variations, like "Form(explicit/path) and
    different line endings (cr, lf, crlf) of the .fb file. no avail.
    Have you carefully checked that all the whitespace in the .fb file are
    spaces, not tabs? The perldoc in CGI::FormBuilder::Source::File says
    "The configuration format steals from Python (ack!) which is sensitive
    to indentation ..." and in my experience, they weren't kidding!

    --

    Jon

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 5, '08 at 3:31p
activeApr 6, '08 at 1:34p
posts4
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase