## 1.8.2 Form Objects

class `Form`( | [name='form'][, action=''][, method='get'][, stickyData=][, enctype=''][, populate=None][, includeName=None])

  `Form` objects have the following class structure and methods:

  `valid`( | )

    tries to vaildate each field. If any of them contain invalid values returns `False` otherwise returns `True`

  `populate`( | form)

    Populates each field from the value of form. form should be a `web.cgi` object.

  `addField`( | field)

    Add the field object field to the form.

  `addAction`( | name)

    Add a Submit button named name to the form. XXX May remove this function in future versions.

  `field`( | name)

    Returns the field object named name

  `__getitem__`( | name)

    Returns the field object named name

  `remove`( | name)

    Remove the field named name from the form

  `has_key`( | name)

    Returns `True` if the form has a field named name, `False` otherwise

  `values`( | )

    Return a tuple containing the values of the form fields in the order they were added. The values of the field can be accessed from the `value` attribute of each item in the tuple.

  `keys`( | )

    Return a tuple containing the names of the form fields in the order they were added

  `dict`( | )

    Return a dictionary containing the names and values of the fields as `key:value` pairs

  `items`( | )

    Return a tuple containing 2-tuples of `(key, value)` pairs where the key is the field name and the value is the field object.

  `html`( | )

    Return an HTML representation of the form

  `hidden`( | )

    Return the form as hidden fields

  `frozen`( | [action=None])

    Return the form as HTML with the values displayed as text and hidden fields instead of the fields. If action is specified a Submit button with the value specified by action is added to the form

  `templateDict`( | )

    Return the form as a dictionary suitable for use in a template.

    The keys include: `'name'`,`'action'`,`'method'`,`'enctype'`,`'fields'`,`'actions'` and `'stickyData'`. `'fields'` is the key to an array dictionarys containg field information with the keys: `'name'`,`'error'`,`'description'`,`'value'` and `'html'`. `'stickyData'` is the stickyData as hidden fields.