## Formwidget

Templating System : Designer Guide : Tag Reference : Formwidget

### Summary

The `formwidget` tag is used to position a form element in a dynamic form template. The element itself 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>First Name</td><td><formwidget id="first_name"></td>
      </tr>
      </table><br>
      <input type=submit value="Submit">
      </formtemplate>

### Notes

- The `formwidget` tag takes the place of `input` and `select` tags in static HTML forms. The system substitutes these tags with the appropriate HTML tags, complete with their proper values, options and other attributes, while rendering the template. Explicit form tags in the template may be used in special circumstances, but should be avoided wherever possible.

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

      <formwidget id="cc_number" onChange="validate();">

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

templating@arsdigita.com