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

A. Pagaltzis pagaltzis at gmx.de
Sun May 20 17:25:52 GMT 2007


* Dave Rolsky <autarch at urth.org> [2007-05-20 16:40]:
> 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.

Why not stash the message in the query string for the redirect
target? Or a hash key.

    303 See Other
    Location: /article/why-webarch-matters?msg=created

Then have infrastructure for an `msg` param to cause a message
box to be shown, with the content “Your article was successfully
created” as found under the `created` key of your message
phrasebook (which also gives you a convenient hook for i18n).

It looks a bit crude, but it’s actually a rather good solution in
REST terms. (Eg. intermediaries won’t cache that resource as the
same you can retrieve from /article/why-webarch-matters where the
message box is missing; etc.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list