[Catalyst] Re: Form validation in insert() and update()?

Dave Rolsky autarch at urth.org
Sun May 20 15:29:44 GMT 2007


On Sun, 20 May 2007, Matt S Trout wrote:

> I used to do that, but I've found that what I thought were style reasons
> mostly turned out to be insufficiently flexible tooling reasons and I'm
> finding one URI works pretty well under Cat.
>
> Would you mind elaborating as to why you're keeping separate URIs? (rather
> than one that behaves differently on GET vs. POST)

I've always though that the form is a different "thing" from the the thing 
that handles its submission, and to combine them doesn't make sense.

There's also something about the whole "if-else" logic that ends up 
handling this that becomes rather gross. Of course, if you can make the 
framework handle this by considering the method and dispatch based on 
that, it becomes less gross.

OTOH, if you're thinking in REST terms, the form is not the same thing as 
the entity or collection of entities to which you'd POST or PUT.

Also, consider the case where the form submission is successful. If the 
action is a create or update, you want to redirect to the URI for the 
thing being created or updated. You may _also_ want to include some form 
"successfully updated" message, so this pattern works well for this. 
That's not very RESTful, though, which is making me think about this some 
more for my latest project.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/



More information about the Catalyst mailing list