<menu>

Allows user to choose among alternative destinations.

Syntax

 <menu
     id="string"
     scope="document"|"dialog"
     dtmf="dtmf_sequence"
     accept="exact"|"approximate"
 >
   Child Elements
 </menu>

Description

Dialog that transitions to <choice> destinations based on user input.

Attribute Description
id

Menu identifier. Optional.

Lets you specify this menu as the target for a <goto> or <submit>.

scope

Sets the scope of the menu's grammar. Optional (default is dialog).

 •  document--The menu's grammar is active throughout the current document. If the document is the application root document, then it is active throughout the application (application scope).
 •  dialog--The menu's grammar is active only in the current menu.
dtmf

Enables DTMF selection for all choices in this menu. Optional (default is false).

 •  true--The interpreter assigns DTMF selectors of 1, 2, and so on to the first 9 or fewer <choice> elements in document order that do not explicitly specify a DTMF sequence using the dtmf attribute.
 •  false--The interpreter does not make implicit DTMF assignments to menu choices with no DTMF sequences.

Note that at most 9 choices can be assigned DTMF selectors with this attribute. If the menu contains more than 9 choices, you can explicitly assign selectors to the additional choices using the dtmf attribute of their <choice> tags.

If you set this attribute to true, any values you specify for dtmf attributes of individual choices must be different from the numbers that will be assigned automatically. For example, If the menu contains 4 choices with no dtmf attribute, those choices will be assigned the selectors 1 through 4. The other choices should have their dtmf attributes set to 0, *, #, or a number greater than 4. If the menu tries to assign the same DTMF selector to more than one choice, an error.badfetch event is thrown when the containing document is fetched.

accept

New in VoiceXML 2.0. Specifies whether the default grammars generated for <choice> elements require all words or accept a subset of the words.

 •  exact--Requires the user to say the exact phrase that appears in the <choice> element.
 •  approximate--Allows the user to say a subset of the words in the <choice> element.

Note: The default is exact if the version attribute of the containing <vxml> element is 2.0 or greater. For backward compatibility, the default is approximate if the version attribute is less than 2.0.

Usage

Parents Children
<vxml>
<audio>
<catch>
<choice>
<enumerate>
<error>
<help>
<noinput>
<nomatch>
<prompt>
<property>
<script>
<value>

Exceptions

error.semantic - Thrown if no grammars are active.

See Also

 •  VoiceXML 2.0 Specification: <menu>
 •  Related tags: <choice>, <enumerate>

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">
   <menu id="mainMenu" >
     <prompt> 
       This is the main menu. Where do you want to
       start to complete your order? <enumerate/>
     </prompt> 
     <choice next="#dateForm"> date </choice>
     <choice next="#quantityForm"> quantity </choice>
     <choice next="#phoneForm"> phone </choice>
   </menu>
   <form id="dateForm">
     <field name="date" type="date">
       <prompt> When do you want to pick up your order?</prompt>
       <filled>
         <prompt> 
           Just to confirm, I heard you say you will pick it up on
           <say-as type="date"> <value expr="date"/> </say-as>
         </prompt> 
       </filled>
     </field>
     <block> <goto next="#quantityForm" /> </block>
   </form>
   <form id="quantityForm">
     <field name="quantity" type="number">
       <prompt> How many bags of candy do you want?</prompt>
       <filled>
         <prompt> 
           Okay, you have ordered <value expr="quantity"/> 
           bags of candy.
         </prompt> 
       </filled>
     </field>
     <block> <goto next="#phoneForm" /> </block>
   </form>
   <form id="phoneForm">
     <field name="phone" type="phone">
       <prompt> At what number can I reach you when the order is ready? 
</prompt> 
       <filled>
         <prompt> 
           I guess <say-as type="telephone"> <value expr="phone"/> </say-as>
           is your home number.
         </prompt> 
       </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