[pmwiki-devel] Question about Forms & Actions

The Editor editor at fast.st
Mon Dec 11 03:42:40 CST 2006


Hi List!

Here is part of an email exchange between Ben who is working hard on a
powerful database module and me, about a proposed change to ZAP.  I
realized I don't really understand the difference between the action
parameter in the form field and the action input field which is set to
ZAP, and causes the engine to be called.

Can someone help explain this so I can know what to do?

> Ben's suggestion:  Change line 443 to
>
>        global $ScriptUrl,$pagename;
>
> and line 450 to
>
>        return "(:input form action=$ScriptUrl?n=$pagename$u$o:)\n(:input
> hidden action zap:)\n(:input hidden ZAPkey $x:)\n";
>
> so that the action of the form is specified rather than left up to the
> browser.  This is important for my purposes because I'm using a ZAP form
> as the EditForm, and if the action of the form is unspecified, the
> browser uses the URL of the current page, including the ?action=edit
> part, which means that the action=zap doesn't happen.

(Ben, did you check this?  I thought ZAP automatically stripped off
any GET values beyond the page name...)

> In the long run you might want to think about providing for an action
> parameter in the (:zapform:) markup, in case people want a form to
> submit its contents to a page other than the current one.

I'll have to look into this a little bit more... You'll notice there
is the hidden field action=zap.  I'm not sure if that is the same as
the action in the form, or how those inter-relate.  I do know, ZAP
only works when the action is set to ZAP.  But perhaps the action in
the field is different from the action as a parameter in the form
field.  I wonder if the $HandleActions['zap'] = 'ZAPengine'; line in
my code looks for a hidden field called action and uses that...  I
know--I'll ask Pm!

PS. As an after thought, how would this affect the following lines:

	if ( . . . ) {
		HandleBrowse($pagename);
		}
	else Redirect(FmtPageName($_POST['nextpage'] . $passdata, $pagename));

Which decides where the user is to be forwarded to...  Would the
action parameter in the form field take precedence over either of
these commands?

Cheers,
Caveman



More information about the pmwiki-devel mailing list