## Formtemplate

Templating System : Designer Guide : Tag Reference : Formtemplate

### Summary

The `formtemplate` tag is used to embed a dynamic form in a template. The elements of the form must be created in the Tcl script associated with the template.

### Usage

      <formtemplate id="add_user">
      <table>
      <tr>
        <td>First Name</td><td><formwidget id="first_name"></td>
      </tr>
      <tr>
        <td>Last Name</td><td><formwidget id="last_name"></td>
      </tr>
      </table><br>
      <input type=submit value="Submit">
      </formtemplate>

### Notes

- The `formtemplate` tag takes the place of the `form` tag in a static HTML form. Explicit form tags in the template should not be used to enclose dynamic forms.

- If the body of the `formtemplate` is empty, the templating system will generate a form automatically based on the list of elements created in the Tcl script associated with the template:

      <formtemplate id="add_user" style="standard"></formtemplate>

  The `style` attribute is optional. It may be used to select a style template from `/ats/templates/forms` for determining the layout of the auto-generated form. The default style is defined in the DefaultFormStyle parameter on the acs-templating package, and is by default set to `standard`, which is included in the distribution.

- HTML attributes, including JavaScript event handlers, may be specified as attributes to the `formtemplate` tag. The system will include all such attributes in the `form` tag of the rendered HTML form.

      <formtemplate id="add_user" onSubmit="validate();">

  This will work for both autogenerated and explicitly formatted forms.

- See the `formwidget` and `formgroup` tags for more information on writing the body of a dynamic form template.

templating@arsdigita.com