Last reviewed: 3/23/2024 12:30:27 PM

<option>

An <option> element specifies an option in a <field> element.

Syntax

<option accept="accepttype"
        dtmf="dtmfsequence"
        value="string" />

Attributes

accept

Defines the matching criteria. Each <choice> can override this setting.

Accept Type Description
approximate The text of the choice elements defines an approximate recognition phrase.
exact The text of the choice elements in the menu defines the exact phrase to be recognized.

dtmf

An optional DTMF sequence for this option. It is equivalent to a simple DTMF <grammar> and DTMF properties apply to recognition of the sequence. Unlike DTMF grammars, whitespace is optional: dtmf="123#" is equivalent to dtmf="1 2 3 #". If unspecified, no DTMF sequence is associated with this option so it cannot be matched using DTMF.

value

The string to assign to the field's form item variable when a user selects this option, whether by speech or DTMF. The default assignment is the CDATA content of the <option> element with leading and trailing white space removed. If this does not exist, then the DTMF sequence is used instead. If neither CDATA content nor a dtmf sequence is specified, then the default assignment is undefined and the field's form item variable is not filled.

Children

none

Parents

<field>

Variables

none

Example

The following example illustrates using example elements.

<field name="maincourse">
  <prompt>
      Please select an entree. Today, we are featuring <enumerate/>
  </prompt>

  <option dtmf="1" value="fish"> swordfish </option>
  <option dtmf="2" value="beef"> roast beef </option>
  <option dtmf="3" value="chicken"> frog legs </option>

  <filled>
    <submit next="/cgi-bin/maincourse.cgi"
        method="post" namelist="maincourse"/>
  </filled>
</field>

Version Information

Supported in: VoiceXML 1.0, VoiceXML 2.0, and VoiceXML 2.1.