<form>

Presents information and collects data.

Syntax

 <form
     id="string"
     scope="document"|"dialog"
 >
   Child Elements
 </form>

Description

A dialog for collecting user input.

Note that when you reach the end of a form, execution does not proceed to the next form on the page. If you do not explicitly transition to another dialog using <goto> or <submit>, then the application terminates when the form completes.

When execution leaves a form, all variables whose scope is that form go away. If you want to retain the value of a form-level variable after leaving the form, you must copy the value into a variable with document or application scope.

Attribute Description
id

The name of the form.

scope

Sets the default scope of the form's grammars. Optional (default is dialog).

 •  document--The form's grammars are active throughout the current document. If the document is the application root document, then they are active throughout the application (application scope).
 •  dialog--By default, the form's grammars have dialog scope, which means they will be active only in this form.

Usage

Parents Children
<vxml>
<bevocal:listen>
<bevocal:register>
<bevocal:verify>
<block>
<catch>
<data>
<error>
<field>
<filled>
<grammar>
<help>
<initial>
<link>
<noinput>
<nomatch>
<property>
<record>
<script>
<subdialog>
<transfer>
<var>

Exceptions

error.semantic - If no grammars are active when input is expected in a form

See Also

 •  VoiceXML 2.0 Specification: <form>
 •  Related tags: <field>, <block>, <record>, <transfer>, <subdialog>, <initial>, <grammar>

Examples

 <?xml version="1.0" ?>
 <!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
  "http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
 
 <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
   <form id="welcome">
     <block>You are in Form One. Welcome back home! </block>
     <field name="hello">
       <grammar type="application/x-nuance-gsl">
         [next dtmf-1 start]
       </grammar>
       <prompt>
         Say next or press one to go to Form 2 or start to start over again.
       </prompt>
       <filled>
         <if cond="hello=='next'|| hello=='dtmf-1'">
           <goto next="#comeagain"/>
         <else/>
           <goto next="#welcome"/>
         </if>
       </filled>
     </field>
   </form>
   <form id="comeagain">
     <block>You are now in Form 2.</block>
     <field name="goback" type="boolean">
       <grammar type="application/x-nuance-gsl">
         [back dtmf-2 continue]
       </grammar>
       <prompt>
         Say back or press two to go to Form 1 or say continue 
         to enter this form again.
       </prompt>
       <filled>
         <if cond="goback=='back'|| goback=='dtmf-2'">
           <prompt>Thanks for stopping by Form 2. Please come again.</prompt>
           <goto next="#welcome"/>
         <else/>
           <goto next="#comeagain"/>
         </if>
       </filled>
     </field>
   </form>
 </vxml>

[Show Frames]   [FIRST] [PREVIOUS] [NEXT]
BeVocal, Inc. Café Home | Developer Agreement | Privacy Policy | Site Map | Terms & Conditions
Part No. 520-0001-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL