Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer_guide:voicexml_references:elements:option [2015/10/27 21:40] (current)
borja created
Line 1: Line 1:
 +====== < option > ======
  
 +===== Description =====
 +
 +The <​option>​ element specifies an option in a <​field>​. ​ It is a convenient way to specify a list of choices in a field without specifying a grammar. ​ The grammar is generated automatically from the text contained in each <​option>​.
 +
 +===== Syntax =====
 +
 +<​code>​
 +<option
 +dtmf="​DTMF sequence"​
 +value="​String">​
 +text
 +</​option>​
 +</​code>​
 +
 +===== Attributes =====
 +
 +|dtmf|The dtmf attribute is the DTMF sequence for this option. ​ This attribute is optional, yet is required if the menu has the dtmf attribute that is true.|
 +|value|The value attribute is the string to assign to the field item variable. ​ This option is selected, whether by speech or DTMF.  This attribute is optional and defaults to the dtmf attribute if specified. Otherwise, it defaults to the option text with leading and trailing white space removed.|
 +
 +===== Parents =====
 +
 +<​code>​
 +<​field>​
 +</​code>​
 +
 +===== Children =====
 +
 +<​code>​
 +None.
 +</​code>​
 +
 +===== Extensions =====
 +
 +<​code>​
 +None.
 +</​code>​
 +
 +===== Limitations/​Restrictions =====
 +
 +<​code>​
 +The attribute dtmf is required, if the menu has the dtmf attribute that is true.
 +</​code>​
 +
 +===== Example Code =====
 +
 +<​code>​
 +<?xml version="​1.0"?>​
 +<vxml version="​2.0"​ xmlns="​http://​www.w3.org/​2001/​vxml">​
 + <​form>​
 +  <field name="​maincourse">​
 +   <​prompt>​
 +     ​Please select an entree. Today, we're featuring:
 +    <​enumerate/>​
 +   </​prompt>​
 +   <​option dtmf="​1"​ value="​fish">​ swordfish </​option>​
 +   <​option dtmf="​2"​ value="​beef">​ roast beef </​option>​
 +   <​option dtmf="​3"​ value="​frog">​ frog legs </​option>​
 +   <​filled>​
 +    <​prompt>​
 +     <​value expr="​maincourse"/>,​ good choice.
 +     ​Please enjoy your meal.
 +    </​prompt>​
 +    <submit next="​maincourse.cgi"​
 +     ​method="​post"​ namelist="​maincourse"/>​
 +   </​filled>​
 +  </​field>​
 + </​form>​
 +</​vxml>​
 +</​code>​