PmForm /
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$PmFormarray, 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.
(:input widget-type $:PTVname :)(:input widget-type $:PTVname value:)(:input widget-type nonPTVname value:)- and other variants (see PmWiki:Forms, especially standard input controls list)
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 ?
- can be loaded with
- 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.
- still can be defaulted with