[Catalyst] best practices for handling forms?

Octavian Rasnita orasnita at gmail.com
Tue Sep 21 19:15:32 GMT 2010


You don't need to do the redirect if you don't want it, but it is the recommended way.

Instead of the redirect, you can forward to another method that prints the page you want:

$c->forward('foo/success_method', ['possible', 'parameters']);

In that case after the data is stored in DB, the specified method is called.

But after doing a POST request it is a good idea to do a redirect because if the user would refresh the page, he might send the posted data again.

Octavian

----- Original Message ----- 
From: "E R" <pc88mxer at gmail.com>
To: "The elegant MVC web framework" <catalyst at lists.scsys.co.uk>
Sent: Tuesday, September 21, 2010 8:25 PM
Subject: Re: [Catalyst] best practices for handling forms?


> Hernan, Octavian - thanks for your replies.
> 
> Both of you have given examples where the display of the form and the
> processing of the form are handled by the same method. In that case in
> order to go from one page to the next you always need to use a
> redirect. Doing this is very clean, but it involve another
> communications round trip.
> 
> If the form display and form processing are handled by separate
> methods, you can avoid the redirect if you're careful.
> 
> Any thoughts on this issue?
> 
> Thanks,
> ER
> 
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/



More information about the Catalyst mailing list