[pmwiki-devel] Form messages question

marc gmane at auxbuss.com
Wed Jan 3 11:25:08 CST 2007


Patrick R. Michaud said...
> 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.

I thought so, but I couldn't see another way. Up until now, I've 
embedded forms in the handler scripts, but it seemed like time to do it 
more the PmWiki Way.
 
> 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).

Ah! Most excellent. I couldn't find a recipe using this and couldn't 
make head nor tail of what it is doing :-|

Should I simply exit the handler function with return after HandleBrowse
()? (On the presumption that I'm done with the function, obviously ;-) )

This is an incredibly useful piece of info. Thanks.

-- 
Cheers,
Marc




More information about the pmwiki-devel mailing list