Difference: TWikiForms (23 vs. 24)

Revision 242007-04-29 - TWikiContributor

Line: 1 to 1
Deleted:
<
<
 
Changed:
<
<

TWiki Forms

>
>

TWiki Forms

  Add structure to content with forms attached to twiki topics. TWiki forms (with form fields) and formatted search are the base for building database applications.
Added:
>
>
 

Overview

Changed:
<
<
By adding form-based input to freeform content, you can structure topics with unlimited, easily searchable categories. A form is enabled for a web and can be added to a topic. The form data is shown in tabular format when the topic is viewed, and can be changed in edit mode using edit fields, radio buttons, check boxes and list boxes. Many different form types can be defined in a web, though a topic can only have only form attached to it at a time.
>
>
By adding form-based input to freeform content, you can structure topics with unlimited, easily searchable categories. A form is enabled for a web and can be added to a topic. The form data is shown in tabular format when the topic is viewed, and can be changed in edit mode using edit fields, radio buttons, check boxes and list boxes. Many different form types can be defined in a web, though a topic can only have one form attached to it at a time.
  Typical steps to build an application based on TWiki forms:
  1. Define a form template
Line: 64 to 65
 
Public FAQ
Changed:
<
<
Field values can also be obtained as the result of a FormattedSearch. For example,
>
>
Field values can also be set using the result of expanding other TWiki variables. For example,
 
Changed:
<
<
%SEARCH{"Office$" scope="topic" web="%MAINWEB%" nonoise="on" type="regex" format="$web.$topic" separator=", " }%
>
>
%SEARCH{"Office$" scope="topic" web="%USERSWEB%" nonoise="on" type="regex" format="$web.$topic" separator=", " }%
 
Changed:
<
<
when used in the value field of the form definition, this will find all topic names in the Main web which end in "Office" and use them as the legal field values.
>
>
When used in the value field of the form definition, this will find all topic names in the Main web which end in "Office" and use them as the legal field values.
 

Enabling Forms by Web

Line: 101 to 102
 
Changed:
<
<
  • ALERT! Note: Initial values will not be submitted to the form of a new topic if you only use the formtemplate parameter.
>
>
  • ALERT! Note: Initial values will not be set in the form of a new topic if you only use the formtemplate parameter.
 

Changing a form

  • You can change a form definition, and TWiki will try to make sure you don't lose any data from the topics that use that form.
Line: 129 to 130
 
  • Type checkbox specifies one or more checkboxes. The Size field specifies how many checkboxes will be displayed on each line. The Value field should be a comma-separated list of item labels.
    • Type checkbox+buttons will add Set and Clear buttons to the basic checkbox type.
  • Type radio is like checkbox except that radio buttons are mutually exclusive; only one can be selected.
Changed:
<
<
  • Type label specifies read-only label text, The Value field should contian the text of the label.
>
>
  • Type label specifies read-only label text. The Value field should contain the text of the label.
 
  • Type select specifies a select box. The Value field should contain a comma-separated list of options for the box. The Size field can specify a fixed size for the box (e.g. 1, or a range e.g. 3..10. If you specify a range, then the box will never be smaller than 3 items, never larger than 10, and will be 5 high if there are only 5 options.
    • There are two modifiers that can be applied to the select type:
      • select+multi turns multiselect on for the select, to allow Shift+Click and Ctrl+Click to select (or deselect) multiple items.
Line: 162 to 163
 Field Value Notes:
  • The field value will be used to initialize a field when a form is created, unless specific values are given by the topic template or query parameters. The first item in the list for a select or radio type is the default item. For label, text, and textarea fields the value may also contain commas. checkbox fields cannot be initialized through the form template.
  • Leading and trailing spaces are not significant.
Changed:
<
<
  • Field values can also be generated through a FormattedSearch, which must yield a suitable table as the result.
  • Variables in the initial values of a form definition get expanded when form values are initialized from the form definition. The escape words $quot ("), $percnt (%), $dollar ($), $n (newline), and $nop can be used to prevent expansion.
>
>
  • Field values can also be generated through a FormattedSearch, which must yield a suitable table as the result.
  • Variables in the initial values of a form definition get expanded when the form definition is loaded.
    • If you want to use a | character in the initial values field, you have to precede it with a backslash, thus: \|.
    • You can use <nop> to prevent TWiki variables from being expanded.
    • The FormatTokens can be used to prevent expansion of other characters.
 General Notes:
  • The topic definition is not read when a topic is viewed.
  • Form definition topics can be protected in the usual manner, using TWikiAccessControl, to limit who can change the form template and/or individual value lists. Note that view access is required to be able to edit topics that use the form definition, though view access to the form definition is not required to view a topic where the form has been used.
Line: 208 to 212
 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* |
Changed:
<
<
%SEARCH{"Main.UserName" scope="text" nosearch="on" nototal="on" order="modified" reverse="on"
>
>
%SEARCH{"Main.UserName" scope="text" nosearch="on" nototal="on" order="modified" reverse="on"
 format="|$topic |$formfield(TopicClassification) |" web="Sandbox"}%
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 1999-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiForms.