[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] Multiple run modes


Mike Tonks said:
> Hi,
>
> I'm looking at CGI::Application prior to use, and one thing is unclear to
> me.
>
> I'll outline a little senario to demonstrate the question:
>
> I have a simple app with four run modes - list, view, edit & update
>
> list does what it say on the tin - lists records in a data table
>
> view ditto, displays a single record
>
> edit displays a form to edit (or add) a record
>
> update sends the posted data to the database
>
>
> In my example, I would like the update run mode to then call the view
> run mode, rather then simply display a rather useless 'update
> complete' message.
>
> Is there a good way to do this with CA?  I  suppose a simple option is
> to simply have update() call view() and return the results, but I
> wondered if there was a preferred solution to this?

Well you could simply call the view runmode after the update runmode has
run, but there are two recommended ways -
CGI::Application::Plugin::Forward and CGI::Application::Plugin::Redirect.
I prefer the latter, as a refresh of the browser doesn't resubmit the data
(which the first two methods would)
>
> Another thought that occurred from scanning the docs would be to put
> the update function in prerun, but this seems wrong somehow.
>
You probably want to avoid this - it's just getting messy


#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.