option
option element
Specifies an option to a user within a field.
Syntax
<option
dtmf = "integer"
value = "string"
/>
Attributes
dtmf |
A DTMF digit for this option. |
value |
The string to assign to the field variable when user input (speech or DTMF) matches the grammar fragment defined as the element content or the DTMF sequence specified by the dtmf attribute. If you do not specify a value string, the dtmf value is returned to the field variable when there is a recognition match. Otherwise, the value string is returned when a recognition match occurs (If dtmf not -specified; can use both). |
Parents
Children
None.
Remarks
The option element specifies a speech or DTMF grammar fragment and a string to assign to the field variable when a recognition match occurs. The option element is a convenient way to define a simple set of options for a user within the field element, replacing the need for an active grammar. You may also specify a grammar, in which case the recognition result from the matched grammar is returned to the field variable.
Examples
In the following example the enumerate element lists the options to the user. The value attribute determines what is returned by the recognizer, and the text inside the element defines what the user can say.
<?xml version="1.0"?>
<vxml version="2.1"
xmlns="http://www.w3.org/2001/vxml">
<form id="pick_city">
<field name="city">
<prompt>
Choose one of the seven following destinations
<!-- list the options -->
<enumerate/>
</prompt>
<option dtmf="1" value="delhi"> Deli India </option>
<option dtmf="2" value="tokyo"> Tokyo Japan </option>
<option dtmf="3" value="beijing"> Beijing China </option>
<option dtmf="4" value="calcutta"> Calcutta India </option>
<option dtmf="5" value="hong_kong"> Hong Kong </option>
<option dtmf="6" value="london"> London Great Britain </option>
<option dtmf="7" value="paris"> Paris France </option>
<filled>
have fun in <value expr="city"/>
<exit />
</filled>
</field>
</form>
</vxml>