[pmwiki-users] fun with forms
Patrick R. Michaud
pmichaud at pobox.com
Thu Apr 19 16:01:10 CDT 2007
On Thu, Apr 19, 2007 at 03:39:00PM -0500, Ben Stallings wrote:
> Pm wrote,
> > Just to sneak peek how my version of forms processing is
> > coming along, take a look at:
> >
> > http://www.pmwiki.org/wiki/Cookbook/SimpleRating?action=edit&editform=Cookbook.RecipeInfoForm
> >
> > Comments and questions welcomed.
>
> That's very slick. Nice clean syntax, and the ramifications for
> DataPlates, Acme, Fox, et al. are obvious. ;-)
>
> I could use some clarification on this line:
> (:input default request=1 source={*$FullName}:)
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.
source={*$FullName} says to load input defaults with any page text
variable values that are defined in the page given by {*$FullName}.
So, together they mean to load the default control values from any
previous submit and from an existing page.
> The syntax doesn't appear to match that of the existing (:input default
> name value:) tag. ...
Correct. I could have defined them as being their own input
controls -- something like (:input request:) and
(:input source {*$FullName}:), but I decided it was better to
simply make them options to the existing (:input default:).
> If they are parameters of the form itself rather than defaults for
> individual inputs, it seems to me the tag should be
> (:input e_form request=1 source={*$FullName}:)
> instead of input default.
They're defaults for individual inputs, so I put them under
(:input default:). I suppose they could go under (:input e_form:).
> Do I infer correctly that the source parameter (or default value) means
> that all input values for the form are to be taken from the named page?
Except for the "all input values" part. It affects only the
the controls
- that don't already have a default set from somewhere else
- that match the name of a page text variable in the source page
- that don't explicitly specify a value via a value= argument
> 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.
> Does another, input-specific (:input default:) farther down in the form
> override this form-wide default, or does the form-wide one override the
> input-specific one?
The first (:input default:) wins.
> I notice this form is not using the (:e_form:), (:e_savebutton:), etc.
> tags but instead duplicates their functionality. Why is that? Do you
> plan to use those tags in a later version of this recipe, or to keep the
> syntax separate?
I just haven't looked to see how (:e_form:) and (:e_savebutton:)
might interact with this yet. I'm starting with the basics and
then will build up the more complex structures from there.
Thanks!
Pm
More information about the pmwiki-users
mailing list