[Catalyst] Another newbie question...

Bill Moseley moseley at hank.org
Mon Jun 9 22:21:38 BST 2008


On Mon, Jun 09, 2008 at 12:44:07PM -0500, Mitch Jackson wrote:
> On Mon, Jun 9, 2008 at 12:21 PM, Chris Devine <chris at vistaeng.homeip.net> wrote:
> >
> > I am trying to set up a form using a .TT2, but no .fb, using
> > "formbuilder.start" etc. I can assign a value to an input, and it shows on
> > the page, but after submit, the value shows in "[debug] Body Parameters",
> > but when I try to retrieve the value with $form->field, I get "" back. This
> > seems like it should be simple enough, where have I gone astray??
> >
> 
> Sounds like you're looking for:
> $c->request->params->{field}

This is using FormBuilder?


I have not used FormBuilder in a while but wouldn't you want something
like:

    $form->field->{foo};
or
    $form->field('foo');

$c->req->parameters->{foo} is the raw posted data.  I would assume it
could be different if the form validation process modified the input
data.

For example, in Form::Processor, a date input might be one or more
elements of $c->req->parameters, but you would access it as

    $form->field('some_date')->value;

( or shorthand $form->value( 'some_date' ) )

and that would return a DateTime object.



-- 
Bill Moseley
moseley at hank.org
Sent from my iMutt




More information about the Catalyst mailing list