# <form>

Description

Forms are key components in VoiceXML applications. Forms collect user input and present information to the user. A form can define a field item (for collecting user input), or a control item (containing procedural items to help collect inputs).

In standards compliance mode, encountering an invalid element (ex. `<dummy>`) inside a `<form>` will result in an `error.badfetch` event being thrown. If the `com.voicegenie.STRICTCONFORMANCE` property is set to `FALSE`, such invalid elements will just be ignored.

Syntax

    <form
        id="string"
        scope="dialog" | "document"
        cleardtmf="boolean">
      child elements
    </form>

Attributes

Attribute | Description
id | The name of this form. If specified, it can be referenced within the same document or from another document. For example, `<form id="hello">` can be referenced by `<goto next="#hello"/>`. Optional.
scope | The scope of the form's grammars. Optional. (Defaults to dialog.) dialog - The form's grammars are only active within the form. document - The form's grammars are active throughout the document. If the current page is an application root document, then the form grammars are active throughout the application.
cleardtmf | Specifies whether or not the DTMF buffer should be cleared on entry to this form or whether any remaining DTMF inputs from previous forms should be carried over to this form. Set to true to clear the buffer; set to false to carry over DTMF input. Optional. (Defaults to false.)

Attribute Notes

- An `error.badfetch` event is thrown if multiple forms have the same `id` (on the same page).

Parents

<vxml>

Children

<block>, <catch>, <data>, <dtmf>, <error>, <field>, <filled>, <grammar>, <help>, <initial>, <link>, <noinput>, <nomatch>, <object>, <property>, <record>, <script>, <subdialog>, <transfer>, <var>

Extensions

- Added `cleardtmf` attribute.
- Added `<dtmf>` as a child, to be used like `<grammar>`.

Limitations/Restrictions

None.

Example

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form id="first">
        <block>
          This is a form.
          <goto next="#second"/>
        </block>
      </form>
      <form id="second">
        <block>
          This is another form.
        </block>
      </form>
    </vxml>