FORM{} -- render a TWiki form for view

  • Show a table containing data of a TWiki form attached to a topic
  • Syntax: %FORM{topic="..." formfields="..." ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "..." or
    Name of topic containing the TWiki form, such as "Bug1234". Specify topic name or Web.TopicName Current topic
    rev="..." Get the form from the specified topic revision, range "1" to top revision of topic. "0" is equivalent to the top revision The rev URL parameter value if present, else the top revision
    formfields="..., ..." Specify names of TWiki form fields to show, in sequence. The all token shows all remaining fields. "all"
    header="..." Form header, typically containing the form name. If "on", the default format "|  *[[$formweb.$formtopic][$formtopic]]*  ||" is used. If "none", the header is suppressed. Supported variables:
    $formweb - name of web containing the form definition.
    $formtopic - name of topic containing the form definition.
    format="..." Format of one form field. Supported variables:
    $title - raw field name (includes space and other special characters).
    $name - field name (sanitized title).
    $type - form field type.
    $size - size of field or selector.
    $value - form field value.
    $value(20, -<br />) - value hyphenated every 20 characters using separator -<br />.
    $value(30, ...) - value shortened to 30 characters.
    $length - length of form field value.
    $tooltip - tooltip message.
    $attributes - type attributes, such as H for hidden, M for mandatory.
    $formweb - name of web containing the form definition.
    $formtopic - name of topic containing the form definition.
    See details in TWikiForms#FormFieldTypes.
    "| $title: | $value |"
    separator="..." Line separator. Variable $br expands to <br /> tag, and $n to a newline. "$n"
    default="..." Text shown when no form or form fields are found ""
    newline="$br" Convert newlines in textarea to other delimiters. Variable $br expands to <br /> tag, and $n to a newline. Other text is encoded based on encode parameter. "$br" if format is a TWiki table, else "\n"
    encode="html" Encode special characters in form field value into HTML entities. Additional encodings available: encode="quote", encode="moderate", encode="safe", encode="entity" and encode="url". See ENCODE for details. "" (no encoding)
    showhidden="..." Set to "on" to show also hidden form fields. ""
  • Examples:
    • %FORM{topic="%INCLUDINGTOPIC%"}% - show form data of the including topic (typically used in an included header)
    • %FORM{topic="Projects.SushiProject" formfields="Title, Status, Deadline" header="none"}% - show a subset of form fields
    • %FORM{format="$name" header="none" separator=", "}% - get all visible form field names as a list
  • Category: DatabaseAndFormsVariables, DevelopmentVariables, FormattingAndRenderingVariables
Topic revision: r1 - 2014-06-11 - TWikiContributor
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 URCS? Send feedback
Note: Please contribute updates to this topic on at TWiki:TWiki.VarFORM.