There are many ways to build forms using Fox. Basically it provides special markup to replace the
(:input form ..:) and
(:input end:) directives while all the other
(:input:) directives can be used (see PmWiki.Forms), as well as some other special Fox directives. The submitted form input is then rendered into formatted output to some target page or location using one or more templates. More than one page or location within a page can be targeted with specific output.
Fox form structure
- Optional marker to show Fox feedback messages.
- start of form. See Markup Parameters for full list of possible parameters.
- optional other fox markup directives (see below).
(:input <text|textarea|checkkbox|radio|defaults|submit| etc>... :)
- various form controls including a form submit button.
- end of form, with the same unique form name as used in the start of the form. :
Optional form markup
In addition to the start and end fox markup you can use some special markups in between. Each of these can be used multiple times. Fox will build a list of target pages with associated templates and other parameters included in each markup.
(:foxadd target=... [template=...] [foxtemplate=...] ... :)
- for adding content.
(:foxreplace target=... [template=...] [foxtemplate=...] ... :)
- for replacing content.
- for content copying. Note that only the template gets copied as content, no variables will be replaced. Any page attributes of the template page are ignored!
[ptvfields=...] [ptvfmt=...] [ptvclear=...] :)
- for adding and updating PTVs (page text variables)
- for sending email message to small group of recipients on EMailList (needs FoxNotify addon installed).
Page sections can be used for templates as well as targets, like DisplayTemplates#topic and TargetPage#section, and full page names can be used, as well as multiple TemplatePage=>TargetPage pairs (read more about multiple target pages).
(:foxtemplate "one line template string
- for forms needing no multiline template. The foxtemplate markup will be used if no template page is specified. You can only use it once in a form. It is convenient for quick and short templates. Note that \n will create a line break. Within the
markup directives a foxtemplate="..one line template string" parameter can be given, instead of a template page.
(:foxpreviewtemplate "one line template string
- optional alternative template for preview invoked by a Preview button.
- setting input validation checking for input field name. See Input Validation
- source can be a page name like Site.MyEditForm or a page section defined by anchors like SomePage#contactform. If source is a plain anchored section without page name, like #editform, the section will be retrieved by default from page Site.FoxForms or page(s) given in the config variable $FoxFormsFmt. $FoxFormsFmt can be an array of page names. The first section found with the name will be used.
:)markup is encouraged, as the alternative
:)markup drops replacement variables (since PmWiki version 2.2.14), which might be present in the form (See Enable Undefined Template Vars).