< menu >
Description
The < menu > element presents a menu of choices to the user and transitions to another dialog based on user input.
Syntax
<menu id="String" scope="dialog" | "document" dtmf="true" | "false" accept="exact" | "approximate"> child elements </menu>
Attributes
id | The id attribute defines the name of the form. If specified, it can be referenced within the same document or from another document. For example, <form id=“hello”> can be referenced as <goto next=“#hello”/>. This attribute is optional. |
scope | The scope attribute defines the scope of the form’s grammar. This attribute is optional and defaults to dialog. * dialog – the form’s grammars are only active within the form. * document – the form’s grammars are active throughout the document. If this is an application root document, then the form’s grammars are active throughout the application. |
dtmf | The dtmf attribute enables DTMF input for all menu choices. This attribute is optional and defaults to false. * true – the interpreter assigns a DTMF sequence “1”, “2”, “3”… to the choices in order for all menu choices that do not explicitly define a DTMF sequence. * false – the interpreter does not implicitly assign DTMF sequences. |
accept | The accept attribute specifies the default grammar for each <choice> element. This attribute is optional and defaults to exact. * exact – the text of the <choice> element that defines the exact phrase to be recognized. * approximate – the text of the <choice> element that defines an approximate recognition. |
phrase | The phrase attribute is a subset of the words in the phrase expression that can be matched. For example, “Hello world” can be matched with “Hello world”, “Hello”, or “World”. |
Parents
<vxml>
Children
<audio>, <catch>, <enumerate>, <error>, <help>, <noinput>, <nomatch>, <prompt>, <property>, <record>, <value>
Extensions
None.
Limitations/Restrictions
None.
Example Code
<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <menu dtmf="true"> <prompt> What information do you want? <enumerate> For <value expr="_prompt"/>, press <value expr="_dtmf"/> </enumerate> </prompt> <choice dtmf="1" next="#exit"> goodbye </choice> <choice dtmf="2" next="sports.vxml"> sports </choice> <choice dtmf="3" next="weather.vxml"> weather </choice> <choice dtmf="4" next="stock.vxml"> stock </choice> </menu> <form id="exit"> <block> Good bye. <disconnect/> </block> </form> </vxml>