Tags:
create new tag
view all tags

EDITFORM{} -- render a TWiki form for edit

  • Show an HTML form to update the TWiki form data of a topic.
  • Syntax to update a TWiki form: %EDITFORM{topic="..." formfields="..."}%
  • Supported parameters:
    Parameter: Description: Default:
    "..." or
    topic="..."
    Name of topic containing the TWiki form, such as "Bug1234". Specify topic name or Web.TopicName Either "...", topic=""
    or formtemplate=""
    is required
    formtemplate="..." Name of form template topic, such as "BugForm". Specify topic name or Web.TopicName
    elements="..." Elements of edit form: formstart is the HTML form tag, header the form header, formfields the form fields, submit the submit button, hiddenfields are hidden input fields, formend is the HTML form end tag. "formstart, header,
      formfields, submit, hiddenfields, formend"
    header="..." Form header, typically containing the form name. If "on", the default format is used:
    "|  *[[$formweb.$formtopic][$formtopic]]*  ||"
    Supported variables:
    $formweb - name of web containing the form definition.
    $formtopic - name of topic containing the form definition.
    "on"
    formfields="..., ..." Specify names of TWiki form fields to use, in sequence. The all token shows all remaining fields. "all"
    format="..." Format of one form field. Supported variables:
    $inputfield - rendered form input field.
    $title - raw field name (includes space and other special characters).
    $name - field name (sanitized title).
    $size - size of field or selector.
    $value - initial value, or select options.
    $tooltip - tooltip message.
    $attributes - type attributes, such as H for hidden, M for mandatory.
    $extra - extra information, such as * for mandatory field.
    $formweb - name of web containing the form definition.
    $formtopic - name of topic containing the form definition.
    See details in TWikiForms#FormFieldTypes.
    "| $title: $extra | $inputfield |"
    hiddenfields="..., ..." List of form field names to use as hidden fields. For each name listed in hiddenfields="", add a name="value" parameter to specify the value of the hidden input field. If you omit the name="value" parameter for a hidden input field, it will be excluded as a form field, even with a formfields="all". ""
    submit="..." Format of submit button row. Line separator. Variable $submit expands to submit input field with label "Save", $submit(Save) to a submit input field with specific label. "| | $submit |"
    onsubmit="..." Execute JavaScript when the form is submitted, optional. ""
    action="..." Specify a TWiki script (view, edit, save, ...), or the full URL of an action to take on form submit. "save"
    method="..." HTML form action method. "post" for save
    action, else "get"
    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 ""
  • Example: %EDITFORM{ topic="%INCLUDINGTOPIC%" }% - show HTML form to update form data of the including topic (typically used in an included header)
  • Example: Custom form in an included header to update some form field values of the base topic, including one hidden field:
    %EDITFORM{
      topic="%BASEWEB%.%BASETOPIC%"
      formfields="Priority, Status"
      hiddenfields="Updated"
      Updated="%SERVERTIME{$year-$mo-$day}%"
      submit=" | | $submit(Update) |"
    }%
  • Category: DatabaseAndFormsVariables, DevelopmentVariables, EditingAndContentUpdateVariables
  • Related: EDITFORMFIELD, ENCODE, ENTITY, FORM, FORMFIELD, META, METASEARCH, SEARCH, TWikiForms, FormattedSearch, QuerySearch, SearchHelp, TWikiScripts, TWikiTemplates
Topic revision: r1 - 2014-06-11 - TWikiContributor
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 1999-2024 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.VarEDITFORM.