[pmwiki-devel] RFC: Configurable redirect in PmForm
Petko Yotov
5ko at 5ko.fr
Fri Apr 2 03:47:03 CDT 2010
On Thursday 01 April 2010 05:13:10, DaveG wrote :
> In PmForm HandlePmForm(), a Redirect() is performed at the end of
> processing. This prohibits additional cookbook processing after PmForm.
> Specifically it means that any Ajax oriented PmForm requests are not
> possible.
A while ago I tinkered with an Ajax webapp and I used this line :
if(@$_GET['ajax']>'') $EnableRedirect = 0;
The JavaScript sends the PmForm with an additional parameter "&ajax=1". This
blocks the redirects and sends a HTML page and the JavaScript program can
parse it and decide what to do.
> My proposal is below, although I'm open to any change that allows
> re-directing to a cookbook defined function.
Alternatively, you can write/clone your own MyHandlePmForm() without the
redirect, and use $HandleActions['pmform'] = 'MyHandlePmForm';
> Change to PmForm, last line in HandlePmForm() from:
> Redirect($pagename, '{$PageUrl}?pmform=success');
>
> To:
> $PmFormRedirect('success');
>
>
> And the addition of a function:
> function PmFormRedirect($msg){
> global $pagename;
> Redirect($pagename, '{$PageUrl}?pmform='.$msg);
> }
>
> And at the start of PmForm, the initialization of the new variable:
> SDV($PmFormRedirect,'PmFormRedirect');
It might be more something like this :
SDV($PmFormRedirectFunction,'Redirect');
$PmFormRedirectFunction($pagename, '{$PageUrl}?pmform=success');
Petko
More information about the pmwiki-devel
mailing list