Parameter |
Description |
Required |
Default value |
Example |
name |
Element name, must be unique. May contain spaces. The element name is used in the validation error feedback. |
required |
- |
name="First name" |
type |
Type of the element - see below for possible types. |
required |
- |
type="text" |
Creates a textfield; use size and maxlength to set the length. |
- |
- |
%FORMELEMENT{ name="comment" type="text" title="Comment" }% |
type="textonly" |
Does not use a form field but writes the value as text inside an HTML span with class formPluginTextOnly . The value is passed when submitting the form using a hidden field. |
- |
- |
%FORMELEMENT{ name="name" type="textonly" value="%WIKIUSERNAME%" }% |
type="password" |
Creates a password textfield; otherwise same as text . |
- |
- |
%FORMELEMENT{ name="pw" type="password" }% |
type="upload" |
Creates an upload field; use with STARTFORM parameter action="upload" and set the name to "filepath" . |
- |
- |
%STARTFORM{ name="uploadpicture" action="upload" topic="%WEB%.%TOPIC%" method="post" }% %FORMELEMENT{ type="upload" name="filepath" title="Attach profile picture" }% ... |
type="textarea" |
Creates a textarea; use params rows and cols to set the size. |
- |
- |
%FORMELEMENT{ name="body" type="textarea" title="Message:" rows="5" cols="80" }% |
type="select" |
Creates a variable sized selection box; use param size to set the visible number of items; use options to pass dropdown values, labels to set the option labels, and value to set the default selected values. |
- |
- |
%FORMELEMENT{ name="friend" type="select" size="5" title="Select friend:" options="mary, peter, annabel, nicky, jennifer" labels="Mary M, Peter P, Annabel A, Nicky N, Jennifer J" }% |
type="selectmulti" |
Same as select with multiple items selectable; use options to pass dropdown values, labels to set the option labels, and value to set the default selected values. |
- |
- |
%FORMELEMENT{ name="friends" type="selectmulti" size="5" title="Select friends:" options="mary, peter, annabel, nicky, jennifer" labels="Mary M, Peter P, Annabel A, Nicky N, Jennifer J" value="mary,annabel" }% |
type="dropdown" |
Same as select with 1 item visible; use options to pass dropdown values, labels to set the option labels, and value to set the default selected value. |
- |
- |
%FORMELEMENT{ name="friend" type="dropdown" title="Select friend:" options="mary, peter, annabel, nicky, jennifer" labels="Mary M, Peter P, Annabel A, Nicky N, Jennifer J" value="peter" }% |
type="checkbox" |
Creates a set of checkboxes; to put checkboxes on line each set fieldformat="$e <br />" ; use options to pass dropdown values, labels to set the option labels, and value to set the default selected values. |
- |
- |
%FORMELEMENT{ name="name" type="checkbox" title="Choose a name:" options="mary=Mary M, peter=Peter P, annabel=Annabel A, nicky=Nicky N, jennifer=Jennifer J" fieldformat="$e<br />" value="mary,peter" }% |
type="radio" |
Creates a set of radio buttons; to put radio buttons on line each set fieldformat="$e <br />" ; use options to pass dropdown values, labels to set the option labels, and value to set the default selected values. See also param dateformat . |
- |
- |
%FORMELEMENT{ name="name" type="radio" title="Choose a name:" options="mary=Mary M, peter=Peter P, annabel=Annabel A, nicky=Nicky N, jennifer=Jennifer J" fieldformat="$e<br />" value="mary" }% |
type="date" |
Creates a date button; requires DatePickerPlugin (installed by default). |
- |
- |
%FORMELEMENT{ name="date" type="date" dateformat="%e-%b-%y" title="Select date:" }% |
type="submit" |
Creates a submit button. |
- |
- |
%FORMELEMENT{ name="action" type="submit" buttonlabel="Send info" }% |
type="hidden" |
Creates a hidden input field. |
- |
- |
%FORMELEMENT{ name="CarbonCopy" type="hidden" default="$Name earns $Salary" }% |
options |
List of selectable value parameters to use with select , dropdown , checkbox or radio . You may use DataForms notation option1=Label 1, option2=Label 2 . |
- |
- |
options="mary, peter, annabel, nicky, jennifer" or options="mary=Mary M, peter=Peter P, annabel=Annabel A, nicky=Nicky N, jennifer=Jennifer J" |
labels |
To use with options : list of visible labels for each option. |
- |
If no labels are set, the option values are displayed. |
labels="Mary M, Peter P, Annabel A, Nicky N, Jennifer J" |
value |
Predefined input: • For single entry elements: the text value. • For multi-select elements: the default selected items; a comma delimited string. • For type="submit" the button label; you may use buttonlabel as well. |
- |
- |
value="%WIKIUSERNAME%" or value="mary, peter, annabel" or value="Submit" |
buttonlabel |
The button label. |
- |
- |
buttonlabel="Submit" |
hint |
Input hint optionally displayed next to the form element. |
- |
- |
hint="Enter a TWiki.WikiWord" |
mandatory |
Indicates if the form element needs to have a value or selection when the form is submitted. When submitted the field must not be empty. Creates a red asterisk (unless the format is defined differently). |
- |
- |
mandatory="on" |
validate |
The type of entry this form element needs to have when the form is submitted: • nonempty single entry elements: must have a value; multi-select elements: must have a selection • string same as nonempty ; this will not test if the input is a number, because for Perl there is no difference between string and number • int the input must be a rounded number • float the input accepts rounded numbers and floating point numbers • email the input must be in e-mail format |
- |
- |
validate="nonempty" |
condition |
Conditionally sets the value value of a form field. Used together with value parameter and a form field token: $name_of_form_field . Use the same parameters as with validate . |
- |
- |
This example will write a bullet item with the value of field date_from , only if that value exists: value=" * $date_from" condition="$date_from=nonempty" |
format |
See Formatting below. |
%FORMELEMENT{ name="comment" type="text" title="Comment" hint="anything" mandatory="on" format=" <b>$t</b> $m $h $e" }% |
fieldformat |
See Formatting below. |
%FORMELEMENT{ name="friends" type="radio" options="mary=Mary M, peter=Peter P, annabel=Annabel A, nicky=Nicky N, jennifer=Jennifer J" fieldformat="$e <br />" }% |
titleformat |
See Formatting below. |
%FORMELEMENT{ name="comment" type="text" title="Comment" titleformat=" <b>$t</b> <br />" }% |
cssclass |
CSS class for the element |
- |
CSS classes: twikiInputField , twikiSubmit |
%FORMELEMENT{ name="Name" type="text" cssclass="twikiBroadcastMessage" }% |
size |
For type="text" or type="password" : the width of the input field measured in number of characters. |
- |
40 |
size="60" |
maxlength |
For type="text" or type="password" : the maximum number of input characters. |
- |
- |
maxlength="12" |
rows |
For type="textarea" : the number of rows. |
- |
- |
rows="5" |
cols |
For type="textarea" : the number of columns. |
- |
- |
cols="80" |
focus |
focus="on" gives text entry focus to a field. Requires javascript. Only one element on the page can have focus. |
- |
- |
focus="on" |
disabled |
disabled="on" disables user input; copying from a disabled input field is not possible. Note: disabled fields are not included into the submitted data. |
- |
- |
disabled="on" |
readonly |
readonly="on" makes the field read-only; copying is possible but not changing. Only works for text fields and textarea. Note: readonly fields are included into the submitted data. |
- |
- |
readonly="on" |
dateformat |
Sets the output format of the date button, for instance: %Y/%m/%d - see date formats for more info. |
- |
Default date format set in configure's Extensions section, DatePickerPlugin settings. |