<menu>

A menu is a convenient syntactic shorthand for a form containing a single anonymous field that prompts the user to make a choice and transitions to different places based on that choice.

Attributes

NameData typeDescription

id

String

The identifier of the menu. It allows the menu to be the target of a <goto> or a <submit>. This attribute does not allow for any white space.

scope

String

(default is “dialog”) The menu's grammar scope. Accepted values include "dialog" and "document".

If set to "dialog", the menu's grammars are only active when the user transitions into the menu.

If set to "document", grammars are active over the whole document (or if the menu is in the application root document, any loaded document in the application).

accept

String

(default is “exact”) Accepted values include "exact" and "approximate".

When set to “exact”, the text of the choice elements in the menu defines the exact phrase to be recognized.

When set to “approximate”, the text of the choice elements defines an approximate recognition phrase.

Each <choice> can override this setting.

dtmf

Boolean

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).

Notes

The id attribute for this tag does not allow for any white space.

Example

<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
?>
<vxml version="2.0">
  <menu id="departments">
    <prompt>
      News Departments:
      Press 1 or say sports to be transfered to Sports.
      Press 2 or say weather to be transfered to Weather.
      Press 3 or say operator assistance to be transferred to Operator Assistance.
    </prompt>
    <choice dtmf="1" next="#sports">Sports</choice>
    <choice dtmf="2" next="#weather">Weather</choice>
    <choice dtmf="3" accept="approximate" next="#operator">Operator Assistance</choice>
    <noinput>Sorry, I didn't hear you.</noinput>
    <nomatch>Sorry, I didn't understand you.</nomatch>
  </menu>
  <form id="sports">
    <block>
      <prompt>
        The Rainbow Cubs hit a home run to win the game.
      </prompt>
    </block>
  </form>
  <form id="weather">
    <block>
      <prompt>
        It's raining cats and dogs.
      </prompt>
    </block>
  </form>
  <form id="operator">
    <block>
      <prompt>
        Sorry, there is no operator assistance available.
      </prompt>
    </block>
  </form>
</vxml>

The output of the above script would be:

Computer: News Departments: Press 1 or say sports to be transfered to Sports. Press 2 or say weather to be transfered to Weather. Press 3 or say operator assistance to be transfered to Operator Assistance. Human: Sports. Computer: The Rainbow Cubs hit a home run to win the game.

Child Tags

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

Parent Tags

<vxml>

Last updated