Last reviewed: 12/15/2024 9:03:45 AM

<form>

A <form> element is a dialog for presenting information and collecting data.

Syntax

<form id="string"
      scope="scopetype" />

Attributes

id

The name of the form. If specified, the form can be referenced within the document or from another document.

scope

The default scope of the form's grammars. Note that the scope of individual form grammars takes precedence over the default scope; for example, in non-root documents a form with the default scope "dialog", and a form grammar with the scope "document", then that grammar is active in any dialog in the document.

Scope Type Description
dialog The form grammars are active only in the form.
document The form grammars are active during any dialog in the same document.

Children

<block>, <catch>, <error>, <field>, <filled>, <grammar>, <help>, <initial>, <link>, <noinput>, <nomatch>, <object>, <property>, <record>, <scriptog>, <subdialog>, <transfer>, and <var>.

Parents

<vxml>

Variables

none

Example

The following example illustrates using example elements.

<form id="weather_info">
 <block>Welcome to the weather information service.</block>
 <field name="state">
  <prompt>What state?</prompt>
  <grammar src="state.grxml"  type="application/srgs+xml"/>
  <catch event="help">
     Please speak the state for which you want the weather.
  </catch>
 </field>
 <field name="city">
  <prompt>What city?</prompt>
  <grammar src="city.grxml" type="application/srgs+xml"/>
  <catch event="help">
     Please speak the city for which you want the weather.
  </catch>
 </field>
 <block>
  <submit next="/servlet/weather" namelist="city state"/>
 </block>
</form>

Version Information

Supported in: VoiceXML 1.0, VoiceXML 2.0, and VoiceXML 2.1.