VoiceXML 2.1 Development Guide Home  |  Frameset Home


<option>  element


The option element is a convenient grammar shortcut, which allows the developer to list simple choices to the caller rather than constructing a complete grammar with return slots.


usage

<option accept="(approximate|exact)" dtmf="CDATA" value="CDATA">


attributes

accept Data Type: (approximate|exact) Default: Optional
accept is a w3c compliant attribute that allows the developer to specify whether an exact or an approximate utterance will be considered a valid grammar match for the phrase contianed within the choice element. If set to 'approximate' then the caller is allowed quite a bit of leeway in regards to how exact the utterance must be, while a setting of 'exact' designates more stringent control of what is considered valid. For example, if the grammar value is the string 'david hasselhoffs self integrity', then an utterance of 'hasselhoff' will be considred a valid match if the accept setting is 'approximate', but not if set to 'exact'.
dtmf Data Type: CDATA Default: Optional
The value of the dtmf attribute specifies a DTMF key press, or a sequence of key presses, a caller may input to choose the listed option. Using this attribute allows the developer to permit both DTMF and voice as valid input for a particular field option.  Please note that when listing a sequence of key presses, whitespace is optional (i.e.  dtmf="123" is equivalent to dtmf="1 2 3").  Also, be aware that if you would like to use the '#' key, you must first change the 'termchar' property, as '#' is the default terminating character.
value Data Type: CDATA Default: Optional
The value attribute specifies the string to use for the field item return when a user selects a particular option. If not specified, then the dtmf value is returned.



shadow variables

none


parents

<field>


children

none


code samples

< Option dtmf-value> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>

<form id="F1">
  <field name="F_1">
    <prompt>
      your choices are
    <break strength="medium"/>
      press one or say shatner, press two or
      say nimoy, press three or say terminal geek.
    </prompt>

    <option value="william shatner" dtmf="1">
        shatner
    </option>

    <option value="leonard nimoy" dtmf="2">
        nimoy
    </option>

    <option value="I still live in my moms basement" dtmf="3">
        terminal geek
    </option>

    <filled>
      <prompt> you said <value expr="F_1"/> </prompt>
    </filled>

  </field>

</form>
</vxml>


<Option accept> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>

<form id="F1">
  <field name="F_1">
    <prompt>
      your choices are
    <break strength="medium"/>
      shatner, nimoy, or terminal geek.
    </prompt>

    <option value="william shatner" accept="approximate">
        bill shatner or captian kirk
    </option>

    <option value="leonard nimoy" accept="approximate">
        lennie nimoy or spock
    </option>

    <option value="living in my moms basement" accept="exact">
        terminal geek
    </option>

    <filled>
      <prompt> you said <value expr="F_1"/> </prompt>
    </filled>

  </field>

</form>
</vxml>



additional links

W3C 2.0 Specification


  ACCOUNT LOGIN
Username:  
Password:  
  You must login with your Voxeo developer account prior to posting or editing your existing posts. If you aren't a member of Voxeo's developer community, click here to register.
  ANNOTATIONS: EXISTING POSTS
safarishane
11/1/2005 5:44 PM (EST)
In your description of the dtmf attribute, you specify...

    Note that the available values for this attribute are '1-9' for VXML 1.0, with support for the '*' key character in VXML 2.0

But, according to the vxml2.0 spec, you should be able to actually list a sequence for picking the option, not just a single character.  Do dtmf sequences work on this platform?
Michael.Book
11/1/2005 9:26 PM (EST)
Howdy "eloy_shane,"

You can indeed specify a sequence, like so:
___________________

<option value="william shatner" dtmf="1 2 3">
  shatner
</option>
___________________

I will let our documentation admin know the error of his ways.  Thank you for your valuable feed-back!


Have Fun,

~ Michael
safarishane
11/2/2005 10:51 AM (EST)
Does it matter if it's space separated between the digits?

Michael.Book
11/2/2005 1:12 PM (EST)
As per the W3C spec, you can do it either way:

<option value="william shatner" dtmf="1 2 3">

... or

<option value="william shatner" dtmf="123">



Best,

~ Michael
safarishane
11/2/2005 2:52 PM (EST)
Excellent, thanks... surly this will make a good addition to the docs.
yashar
5/29/2008 3:36 PM (EDT)
hi,

Actually I have a problem with <option>, I'm using <option> to submit some values from my vxml to the php page using :

<submit next="myquery.php" method="get" namelist="f2 d1"/>

thats fine...

I want to add a choice such as <option> EXIT </option> that when user says that it goes to the form1.

<option> Good </option>
<option> Bad </option>
<option> EXIT </option>

so i want to submit good or bad if is uttered but i want to move to form1 if "exit" is uttered.

I know I can do it with <menu> and <choice> but I dont know how to submit my values if I use <choice> while easily i could use <option> to submit my values to php page.

anybody could show me a way that I can use any of <choice> or <option> to perform both that i require?

Thank you very much

yashar
5/29/2008 4:00 PM (EDT)
hi,

Actually I have a problem with <option>, I'm using <option> to submit some values from my vxml to the php page using :

<submit next="myquery.php" method="get" namelist="f2 d1"/>

thats fine...

I want to add a choice such as <option> EXIT </option> that when user says that it goes to the form1.

<option> Good </option>
<option> Bad </option>
<option> EXIT </option>

so i want to submit good or bad if is uttered but i want to move to form1 if "exit" is uttered.

I know I can do it with <menu> and <choice> but I dont know how to submit my values if I use <choice> while easily i could use <option> to submit my values to php page.

anybody could show me a way that I can use any of <choice> or <option> to perform both that i require?

Thank you very much

VoxeoDustin
5/29/2008 5:19 PM (EDT)
Hey Yashar,

You may want to do something like this:

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">

<form id="F1">
  <field name="F_1">
    <prompt>
      Say good, bad, or exit.
    </prompt>

    <option value="good" dtmf="1">
        good
    </option>

    <option value="bad" dtmf="2">
        bad
    </option>

    <option value="exit" dtmf="3">
        exit
    </option>

    <filled>
      <if cond="F_1 == 'good'">
          <submit next="good.php"/>
      <elseif cond="F_1 == 'bad'"/>
          <submit next="bad.php"/>
      <else/>
          <goto nextitem="#exit"/>
      </if>
    </filled>
  </field>

  <block name="exit">
      <prompt> O K. Goodbye </prompt>
      <exit/>
  </block>

</form>
</vxml>

Cheers,
Dustin
chakri.950
6/24/2009 10:35 AM (EDT)
<field name="F_1">
    <prompt>
          press 1 to accept and 2 to re-enter
    </prompt>
     
    <option value="william shatner" dtmf="1">
        shatner
    </option>
    <option value="leonard nimoy" dtmf="2">
        nimoy
    </option>
    <option value="I still live in my moms basement" dtmf="3">
        terminal geek
    </option>

    <filled>
      <prompt> you said <value expr="F_1"/> </prompt>
    </filled>

    <noinput>
          ....
    </noinput>
    <nomatch>
          ....
    </nomatch>


  </field>

Requirement:  My requirement is that when user enters more than one digit i want to give meesage as "you entered too many digits."

Does it possible by using <option> tag. If not could you please provide the solution. I was struct at this point.

Thanks & Regards,
Kalyan M

VoxeoDustin
6/24/2009 10:45 AM (EDT)
Hello Kalyan,

Using the option element, you will not receive a nomatch unless a caller enters a DTMF key that is not one of the options. If you are looking for a single DTMF entry, once the caller enters at least one key, entry is considered complete and other DTMF keys are ignored. The only way to achieve what you're looking for would be to use a standalone field for DTMF entry and conditional logic to determine if the caller pressed more than one key.

Let me know if we can be of further assistance.

Regards,
Dustin Hayre
Customer Support Engineer II
Voxeo Support
chakri.950
6/24/2009 11:06 AM (EDT)
Thank you so much dustin for your suggestion.

I previously tried with that logic i.e., I handled in filled block with the conditional logic.

Implementation:

I have not used <option> tag. In filled block I used to capture the length of the input what the user entered, through this conditional logic I am giving the corresponding message.


Does the conditional logic in filled block uses more performance of CPU. During our performance testing CPU is using more power.

THanks & Regards,
Kalyan M
MattHenry
6/24/2009 11:28 AM (EDT)


Hello Kalyan,

Implementation of conditional logic shouldn't cause a noticeable spike in processing overhead in any capacity. Can you provide some specifics as to your performance testing, and illustrate exactly how you are validating the host server performance being impacted when conditional logic is being executed at run-time? Ideally, we'd be interested in seeing your server specification, and the test results that you have showing the performance hit.

Standing by,

~Matthew Henry
chakri.950
6/24/2009 11:47 AM (EDT)
Hi Matthew Henry,

Thanks. Sorry to say that I could not provide the details of test results because those are only my assumptions.
Another query I would like to ask. 

In our application we are performing more validations using java script. As per my knowledge all the java script validations are going to be done on IVR server only. If that was the case does this large number validations in java script on IVR server may decrease the performance.

These are just my assumptions which might cause the performance degrade.

Thanks & Regards,
Kalyan M
mikethompson
6/24/2009 12:13 PM (EDT)
Hello Kalyan,

You should not notice any significant difference in application performance by implementing some JavaScript in your code.  There are obviously some CPU cycles used up by using a client-side language like JavaScript, but the difference should be minimal.

Hope this helps,
Mike Thompson
Voxeo Corporation




© 2013 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site