This page lists some important directives you can use on the fmt-template (that is, on a template used in the 'fmt=' part of a PmForm).
  • In the (:template defaults:)/(:template requires:) the 's' letter at the end is optional and is insignificant.

The list of directives:

  • (:template defaults where=above):
This should be used if you want the results of a form appended to some page in some way. In such a situation, the contents of the fmt-template will have all {$$name}-fields filled with values, and will be pasted into the destination page, which can be specified via the saveto= directive
  • Currently (pmform-2007-06-12) implemented values for where are: above, below, top, bottom, new (the default value).
    How do we define the $mark which is required for where=above or where=below?
  • Note: if where=new, the page is written only if it didn't exist before!
  • Note: the default where=new option is executed before savevars, so you can create a page filled using fmt-template (executed only at first time) and fill it with variables using savevars (works many times) in one click.
  • Note: where=above and where=below only work when the page where the form is posted contains a (:pmform...:) directive, and can be overridden by a parameter in that directive like (:pmform target where=below:).
  • (:template require field errmsg="message:) - the field must not be empty
  • (:template require field match=pattern errmsg="message:) - pattern is interpreted as a pagelist-like wildcard - special chars: *, ?, [, ], others?
  • (:template require field if=expression errmsg="message:) - expression is whatever would be good for a regular (:if:) (probably)
All of the above cancel form processing if the validation fails, and display message in the (:messages:) box. The field can be both a PTV-style one and a regular one.
  • {$$field-name}
Gets replaced with a value of a field named field-name sent from the form. Can the PTV fields be accessed by prepending them with ptv_? Or maybe there's no need for that?
DaveG: In the target template fields need to be referenced with {$$ptv_XXX} -- other formats ($:, $$) don't work.
  • (:template defaults savevars=$:var1,$:var2,...:)
Saves the PTV-type form fields as PageTextVariables into the page specified by the saveto= option. If the PTVs exist in destination page, their values are changed according to form contents, and their markup style is preserved (that is: hidden / definition-list / name:value )
  • (:template defaults successpage={$$saveto}:)
  • (:template defaults saveto=page:)
Specifies a page where the data from the form should be saved.
Note: saveto can be specified in fmt-template or in the $PmForm in target description. Both methods apparently allow for different effects:
  • The fmt-template variant can be used with variables submitted via form, so you can write, say, saveto='Friend-{$$friend-name}' See: ClientForm, ClientTemplates
  • The $PmForm variant can be used with standard PmWiki:PageVariables (and other FmtPageName() markup?). Therefore, you can write saveto={*$FullName} or saveto={SomePage$:somePTV}.
Which of the variants has higher priority (overrides the other one)?
 0: 00.00 00.00 config start
 1: 00.00 00.00 config end
 2: 00.02 MarkupToHTML begin
 3: 00.06 MarkupToHTML end
 4: 00.06 MarkupToHTML begin
 5: 00.07 ReadApprovedUrls SiteAdmin.ApprovedUrls begin
 6: 00.07 ReadApprovedUrls SiteAdmin.ApprovedUrls end
 7: 00.08 MarkupToHTML end
 8: 00.08 MarkupToHTML begin
 9: 00.09 MarkupToHTML end
10: 00.09 now