<menu>

Allows the user to specify a choice from a list of options.

Syntax

<menu
    accept = "{exact | approximate}"
    dtmf = "{true | false}"
    id = "identifier"
    scope = "{document | dialog}"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

accept

{exact | approximate}

no

exact

Determines how a choice phrase is activated. Valid values:

  • exact = Utterances must match the entire choice phrase to activate the choice.

  • approximate = Utterances can match a sub-phrase of the choice phrase to activate the choice.

Each choice can override this setting.

dtmf

boolean

no

no

Assigns implicit DTMF elements to the choices contained in the menu. Valid values:

  • true = Assigns implicit DTMF elements to any <choice> element that does not specify a DTMF element.

  • false = Does not assign implicit DTMF elements to <choice> elements.

id

identifier

no

NA

Unique name of the menu. This facilitates the transfer of control from dialog to dialog.

scope

{document | dialog}

no

dialog

Scope for the grammar contained in the menu. Valid values:

  • document = Grammar is active throughout the current document.

  • dialog = Grammar is active only in the current menu.

Parents

<vxml>

Children

<audio>, <catch>, <choice>, <enumerate>, <error>, <help>, <noinput>, <nomatch>, <prompt>, <property>, <script>, <value>

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <catch event="quitEvent">
        Goodbye
        <exit/>
    </catch>
    <!-- 
    With dtmf="true", the DTMF sequence for each 
    choice will be assigned automatically: 1, 2 and 3 
    -->
    <menu id="main" dtmf="true">
        <prompt>What do you want to eat, apple or orange?</prompt>
        <choice next="#formApple"> apple </choice>
        <choice expr="'#' + 'formOrange'"> orange </choice>
        <choice event="quitEvent"> quit </choice>
        <nomatch>Please say one of <enumerate/></nomatch>
    </menu>
    <form id="formApple">
        <block>
            You chose apple
            <exit/>
        </block>
    </form>
    <form id="formOrange">
        <block>
            You chose orange
            <exit/>
        </block>
    </form>
</vxml>

See Also

<choice>, <form>