FormDirectives

Description
This page lists some important directives you can use on the form-template (that is, on a template used in the 'form=' part of a PmForm).
Notes:
  • Some of listed commands are built in core PmWiki and will work without the Cookbook:PmForm recipe.
  • In the (:template defaults:)/(:template requires:) the 's' letter at the end is optional and is insignificant.

The list of directives:

  • (:input pmform target=target-name successpage=page-name:)
You must put it in your form to make it 'special'.
Parameters:
  • target= name of the target declared in $PmForm array, or in a page set in $PmFormPageFmt.
  • successpage= name of a page where the form should be redirected if ended with success.
  • (:input default request=1:)
Managed by forms.php. When errors occur, the form is reloaded with the newly entered values, rather than reloading from the original source.
  • (:input default source={*$FullName}:)
Loads the form fields with values from corresponding PageTextVariables, if found in the {*$FullName} page (you can specify any other page here). A useful shorthand for a list of (:input default x y:)s.
NOTE: If you want to include both default request and default source, then you must include them in the same directive line. Splitting across two lines will not work, unless you put default request before default source.
  • Wrong:
(:input default source=DaveG.FormsTest-Data:)
(:input default request=1:)
  • Right:
(:input default source=DaveG.FormsTest-Data request=1:)
   or
   
(:input default request=1:)
(:input default source=DaveG.FormsTest-Data:)
  • (:template default successpage='':)
  • (:template default name={$$name}:) -- what's this for?
  • (:input default $:name "{$Author}":) and similar
what's the difference between those?
  • (:messages:)
After a form was submitted, displays short information whether it was processed sucessfully or if some errors occured.
Note: you can put this directive in regular pages, not only on forms; but on forms it proves especially useful.
Creates a form control/widget for inputting data from user. Note that the field name can be PTV-like (with $:), or not. The differences are:
  • PTV fields
    • can be loaded with (:input default source=...:)
    • can be saved with (:template defaults savevars=...:) (see FmtDirectives)
    • probably can be referenced as {$$ptv_name} in the fmt-template ?
  • non-PTV fields
    • still can be defaulted with (:input default field value:)
    • can be used to pass commands to PmWiki engine (e.g. 'n', 'action', 'q')
    • can be referenced with {$$name} in the fmt-template.
 0: 00.00 00.00 config start
 1: 00.01 config end
 2: 00.20 MarkupToHTML begin
 3: 00.24 MarkupToHTML end
 4: 00.24 MarkupToHTML begin
 5: 00.25 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
 6: 00.25 ReadApprovedUrls SiteAdmin.ApprovedUrls end
 7: 00.26 MarkupToHTML end
 8: 00.26 MarkupToHTML begin
 9: 00.27 MarkupToHTML end
10: 00.27 now