[cgiapp] CGI::Application::Dispatch [post] runmode not working

Michael Peters mpeters at plusthree.com
Mon Jan 19 10:08:01 EST 2009


P Kishor wrote:

> CGI::Application::Dispatch->dispatch(
>     prefix  => '',
>     default => '',
>     debug => 1,
>     table => [
>         ''                   => { app => $App, rm => 'view' },
>         'find'               => { app => $App, rm => 'find', },
>         'view/:p?/:o?/:s?'   => { app => $App, rm => 'view', },
>         'edit/:p/:o?'        => { app => $App, rm => 'edit', },
>         'other_pages/:p/:o?' => { app => $App, rm => 'other_pages', },
>         'create/:p/:o?'      => { app => $App, rm => 'create', },
>         'save[post]'         => { app => $App, rm => 'save', },
>         '/:p?/:o?/:s?'       => { app => $App, rm => 'view' },
>     ],
>     args_to_new => {
> ..
>         },
>     },
> );

> The 'create' runmode presents a form with 'method="post"' and
> 'action="index.cgi"' and a [submit] button named 'rm' with
> 'value="save"' but the debug switch in the C:A:D table sends messages
> to the log that show that the 'save' rule is never matched.

Dispatch dispatches based on the URL. In your case that URL is going to be "index.cgi". Change the 
action to be "/save", keep your method as "post" and remove the name "rm" from that button (nameless 
buttons are pretty common in web forms).

-- 
Michael Peters
Plus Three, LP



More information about the cgiapp mailing list