[pmwiki-devel] Is EnablePathInfo required for action=$PageUrl in forms?

Petko Yotov 5ko at 5ko.fr
Wed May 8 13:58:51 CDT 2013


Peter Bowers writes:
> On the first one (${PageUrl}, get) it does *not* work.
>
> On the second one (${PageUrl}, post) it *does* work.
>
> On the third one (${ScriptUrl?n={$FullName}, get) it *does* work.

The third method is "post".

Anyways, I have reviewed the standard specifications here:

  http://www.w3.org/TR/html401/interact/forms.html#submit-format
  https://developer.mozilla.org/en-US/docs/HTML/Element/form

and it appears that when you use the "get" method, the browser opens a URL  
which is constructed by the "action" attribute of the <form> element, with  
appended "?" then the url-encoded data set. The browsers I tested strip the  
existing query string from the "action", that is the part starting with "?"  
and construct the URL like in the standard.

When PathInfo is enabled, there is no "?..." part in the $PageUrl string,  
and the browsers don't strip anything; later PmWiki will calculate the  
pagename variable from the query string, so it works.

So, when we use a "get" method and when PathInfo is not enabled, we have to  
add the (:input hidden n {$FullName}:) form field. You can use in the action  
attribute either {$PageUrl} or {$ScriptUrl}.

When we use a "post" method (default for PmWiki forms), the standard sets a  
different encoding format and the browser doesn't strip anything from the  
action URL. So it works on your site and on mine.

It is possible that some browsers or browser versions don't strip the  
existing query string, but recent versions of the major browsers seem to all  
strip it when a form is submitted via the "get" method.

Does this reply to your question?

Petko




More information about the pmwiki-devel mailing list