[pmwiki-devel] Form messages question

Patrick R. Michaud pmichaud at pobox.com
Wed Jan 3 10:23:11 CST 2007


On Wed, Jan 03, 2007 at 11:24:04AM -0000, marc wrote:
> Hi,
> 
> How do you display feedback to a submitted form? Say, validation 
> messages.
> 
> Say, I have a form with:
> 
>   (:input form '' post:)
>   ...
>   (:input hidden action someaction :)
>   (:messages:)
> 
> and to handle this:
> 
>   $HandleActions['SomeAction'] = 'HandleSomeAction';
>   function HandleSomeAction($pagename) {
> 
> I thought that all I needed to do in HandleSomeAction() is:
> 
>   global $MessagesFmt;
>   $MessagesFmt[] = 'some message';
>   Redirect($pagename);
> 
> But this doesn't work.

Redirect($pagename) causes the browser to do a page reload,
which in turn executes another instance of pmwiki.php.
So, any values set in $MessagesFmt[] don't cross over
to the newly reloaded page.

What you probably really want is to simply call 
HandleBrowse() (or whatever is in $HandleActions['browse']),
so that PmWiki will re-display the form along with your
validation message(s).

Pm




More information about the pmwiki-devel mailing list