[Catalyst] Another newbie question...

Chris Devine chris at vistaeng.homeip.net
Tue Jun 10 13:47:43 BST 2008


-----Original Message-----
From: Bill Moseley [mailto:moseley at hank.org]
Sent: Monday, June 09, 2008 4:22 PM
To: The elegant MVC web framework
Subject: Re: [Catalyst] Another newbie question...

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

======================================

Yes, using FormBuilder.

I originally was using $form->field('foo'). I just tried
$form->field->{foo}. They both return "".

I'm not sure why it's not working as it should.

Thanks,
Chris





More information about the Catalyst mailing list