[Catalyst] Forms generation

Bill Moseley moseley at hank.org
Fri Jun 15 00:16:25 GMT 2007

On Thu, Jun 14, 2007 at 11:33:17AM -0700, Michael Reece wrote:
> i've been looking at Form::Processor and similar, but the tricky bit  
> for me is that i want the view to be both responsible for generating  
> the HTML and deciding which fields belong on which form, without an  
> intermediate form object that has to inform both the view and  
> controller.

You can't let the View decide because the client can post whatever
they feel.  And I the Controller shouldn't have to bother with
individual fields, but just if the entire post is valid or not (as the
controller needs to know what page to return).

> the problem becomes giving the view a way to communicate the allowed  
> fields back to the controller without trusting the client.

And, of course, the view isn't involved until displaying the form and
that's too late in the request cycle.

> i've been experimenting with having my form component store the  
> details in the session as its being rendered.

But say someone wants to change their password -- you have to validate
that the old password is correct, the new password matches the
"Enter password again:" field, and that they are different from the old
password.  How do you communicate that logic back to the controller or
whatever in the session?

It makes sense to have a separate form object to handle that work.

Bill Moseley
moseley at hank.org

More information about the Catalyst mailing list