[pmwiki-users] fun with forms
Patrick R. Michaud
pmichaud at pobox.com
Thu Apr 19 18:21:03 CDT 2007
On Thu, Apr 19, 2007 at 06:04:15PM -0500, Ben Stallings wrote:
> Patrick R. Michaud wrote:
> >request=1 means load input defaults from whatever form submission might
> >have led to the current one. For example, if I fill out some fields
> >in a form, hit submit, and some sort of processing error occurs that
> >returns me back to the form, I want the fields to still contain
> >whatever I had entered before. (:input default request=1:)
> >handles this.
>
> Does this functionality, as the name implies, pull from $_REQUEST, which
> incorporates the contents of $_COOKIE as well as $_GET and $_POST?
It only comes from $_GET and $_POST (same as the request=1 option
to (:pagelist:) ).
> If so, might it be useful to allow authors to specify which source(s) they
> want to import data from? With UpdateForm I've found it not only useful
> but *vital* to be able to distinguish between GET data (which may come
> from links) and POST data (which only comes from forms).
We can add that if/when we need it.
> I'm imagining something like
> (:input e_form source=POST,{*$FullName},FormDefaults:)
> to indicate that POST data (but not GET) is to be used first, followed
> by the current page, followed by a FormDefaults page in the current group.
It's not bad -- I'll consider it. Part of the conflict is that
this would requires re-working the e_form markup a fair bit
(currently e_form is a very simple markup with no special options
beyond what (:input form :) provides). We also still need to
have something like (:input default:) available for setting default
values on individual form controls.
> >> Does it apply only to the current form, or to all forms on the page?
> >Currently (:input default:) applies to all forms on a page.
> >The first (:input default:) wins.
>
> I hope you'll reconsider this one. [...]
I'll think about it, but keep in mind that PmWiki's markup engine
currently treats (:input default:) as a separate markup rule from the
other (:input ...:) markups. Thus it doesn't really have any way of
knowing what "form" a particular (:input default:) markup is in,
because all of the (:input default:) markups in a given page are
processed at one time as a group, and not form-by-form.
It may be that we find a way to set defaults on a per-form
basis via some changes to the (:input form ... :) markup,
similar to your suggestions for (:input e_form source=... :) above.
Thanks!
Pm
More information about the pmwiki-users
mailing list