Last reviewed: 12/15/2024 9:05:34 AM

<menu>

A <menu> element is a dialog for choosing amongst alternative destinations.

Syntax

<menu accept="accepttype"
      dtmf="boolean"
      id="var"
      scope="scopetype" />

Attributes

accept

An ECMAScript expression which determines the source of the audio to be played. The expression may be either a reference to audio previously recorded with the <record> element or evaluate to the URI of an audio resource to fetch.

Accept Type Description
approximate The text of the choice elements defines an approximate recognition phrase.
exact The text of the choice elements in the menu defines the exact phrase to be recognized.

dtmf

When set to true, the first nine choices that have not explicitly specified a value for the dtmf attribute are given the implicit ones "1", "2", etc. Remaining choices that have not explicitly specified a value for the dtmf attribute will not be assigned DTMF values (and thus cannot be matched via a DTMF keypress). If there are choices which have specified their own DTMF sequences to be something other than "*", "#", or "0", an error.badfetch will be thrown. The default is false.

id

The identifier of the menu. It allows the menu to be the target of a <goto> or a <submit>.

scope

The menu's grammar scope. If it is dialog (the default), the menu's grammars are only active when the user transitions into the menu. If the scope is document, its grammars are active over the whole document (or if the menu is in the application root document, any loaded document in the application).

Scope Type Description
approximate The text of the choice elements defines an approximate recognition phrase.
exact The text of the choice elements in the menu defines the exact phrase to be recognized.

Children

<audio>, <catch>, <choice>, <enumerate>, <error>, <help>, <noinput>, <nomatch>, <prompt>, <propertygt;, <script>, <value>, and <var>.

Parents

<vxml>

Variables

none

Example

The following example illustrates using a menu.

<menu>
  <choice next="http://www.sports.example.com/vxml/start.vxml">
    <grammar src="sports.grxml" type="application/srgs+xml"/>
    Sports
  </choice>
  <choice next="http://www.weather.example.com/intro.vxml">
   <grammar src="weather.grxml" type="application/srgs+xml"/>
   Weather
  </choice>
  <choice next="http://www.stargazer.example.com/voice/astronews.vxml">
   <grammar src="astronews.grxml" type="application/srgs+xml"/>
   Stargazer astrophysics
  </choice>
</menu>

Version Information

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