Input type | Type field | Size field | Value field |
---|---|---|---|
One or more checkboxes | checkbox | number of items per line | comma list of item labels |
One or more checkboxes, plus Set and Clear buttons | checkbox+buttons | (same) | (same) |
One or more radio buttons (radio buttons are mutually exclusive; only one can be selected) | radio | (same) | (same) |
Read-only label text | label | ignored | text |
Drop-down menu or scrollable box | select | 1 for drop down, 2 and up for scrollable box | comma-separated list of options |
A one-line text field | text | text box width in number of characters | initial text, if a new topic is created with a form template |
A text box | textarea | columns x rows, e.g. 80x6 ; default size is 40x5 | initial text, if a new topic is created with a form template |
YourForm
, ExpenseReportForm
, InfoCategoryForm
, RecordReviewForm
, whatever you need.
Name
, Type
, Size
, Values
, Tooltip message
, and Attributes
(see sample below).
Example: WebFormYou can also retrieve possible values for select, checkbox or radio types from other topics:
| *Name* | *Type* | *Size* | *Values* | *Tooltip message* | *Attributes* |
| TopicClassification | select | 1 | NoDisclosure, PublicSupported, PublicFAQ | blah blah... | |
| OperatingSystem | checkbox | 3 | OsHPUX, OsLinux, OsSolaris, OsWin | blah blah... | |
| OsVersion | text | 16 | | blah blah... | |
Name Type Size Values Tooltip message Attributes TopicClassification select 1 NoDisclosure, PublicSupported, PublicFAQ blah blah... OperatingSystem checkbox 3 OsHPUX, OsLinux, OsSolaris, OsWin blah blah... OsVersion text 16 blah blah...
Example: WebFormField values can also be obtained as the result of a FormattedSearch. For example,
- In the WebForm topic, define the form:
Name Type Size Values Tooltip message Attributes TopicClassification select 1 blah blah... OperatingSystem checkbox 3 blah blah... OsVersion text 16 blah blah...
Leave theValues
field blank.
- Then in the TopicClassification topic, define the possible values:
Name Type Tooltip message NoDisclosure option blah blah... Public Supported option blah blah... Public FAQ option blah blah...
%SEARCH{"Office$" scope="topic" web="%MAINWEB%" nototal="on" nosummary="on" nosearch="on" regex="on" format="$web.$topic" separator=", " }%
when used in the value field of the form definition, will take the set of field values to be all topic names in the Main web which end in "Office".
Notes: label
, text
, and textarea
fields the value may also contain commas. checkbox
fields cannot be initialized through the form template.
label
field has no name (blank first column in the form definition) it will not be shown when the form is viewed, only when it is edited.
select
, checkbox
or radio
field, and want to get the values from another topic, you can use [[...]]
links. This notation can also be used when referencing another topic to obtain field values, but a name other than the topic name is required as the name of the field.
[[...]]
notation.
Tooltip message
column is used as a tooltip for the field name (only if field name is a WikiName) - you only see the tooltip in edit view.
Attributes
column is used to define special behavior for that form field (multiple attributes can be entered, with or without separators): H
indicates that this field should not be shown in view mode. However, the field is available for editing and storing information.
M
indicates that this field is mandatory. The topic cannot be saved unless a value is provided for this field. If the field is found empty during topic save, an error is raised and the user is redirected to an oops
page. Mandatory fields are indicated by an asterisks next to the field name.
WEBFORMS
variable in WebPreferences is optional and defines a list of possible form templates.
Example:
- Set WEBFORMS = BugForm, FeatureForm, Books.BookLoanForm
WEBFORMS
enabled, an extra button is added to the edit view. If the topic doesn't have a Form, an Add Form button appears at the end of the topic. If a Form is present, a Change button appears in the top row of the Form. The buttons open a screen that enables selection of a form specified in WEBFORMS
, or the No form option.
WebTopicEditTemplate
topic in a web, or a new topic that serves as an application specific template topic. Initial Form values can be set there.
formtemplate
parameter in the (edit or save) URL. Initial values can then be provided in the URLs or as form values: name
, ex: ?BugPriority=1
namevalue=1
, ex: ?ColorRed=1
. <form name="newtopic" action="%SCRIPTURLPATH{"edit"}%/%WEB%/"> <input type="hidden" name="formtemplate" value="MyForm" /> New topic name <input type="text" name="topic" size="40" /> <input type="submit" value="Create" /> </form>
SubmitExpenseReport
topic where you can create new expense reports, a SubmitVacationRequest
topic, and so on. These can specify the required template topic with its associated form. Template topics has more.
FORMFIELD
, SEARCH
and METASEARCH
variables in TWikiVariables, and TWiki Formatted Search.
Example
TWiki users often want to have an overview of topics they contributed to. With the$formfield
parameter it is easy to display the value of a classification field next to the topic link:| *Topic* | *Classification* | %SEARCH{"%MAINWEB%.UserName" scope="text" regex="off" nosearch="on" nototal="on" order="modified" reverse="on" format="|<b>[[$web.$topic][$topic]]</b> |<nop>$formfield(TopicClassification) |" web="Sandbox"}%
checkbox
+multi
anywhere in the name
text
fields when a topic is saved. If you need linefeeds in a field, make sure it is a textarea
.
twikicatitems.tmpl
. The replacement Form Template must be set as the first item in the WebPreferences variable WEBFORMS
. If missing, pages will display, but attempting to edit results in an error message.
The new Form Template system should work with old Category Table data with no special conversion. Data is assigned to Meta variables the first time an imported topic is edited and saved in the new system.
If things aren't working correctly, there may be useful entries in data/warning.txt
.
Related Topics: UserDocumentationCategory, TWikiTemplatesUSER REFERENCES
ADMIN MAINTENANCE
CATEGORIES WEBS PERSONAL |
Copyright © by the contributing authors. Bernstein - The Memory of Paper http://www.bernstein.oeaw.ac.at Ideas, requests, problems regarding Bernstein? Send feedback Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiForms |