developer_guide:voicexml_references:elements:initial

< initial >

The < initial > element declares initial logic upon entry into a mixed-initiative form. Unlike < field >, < initial > has no grammars and no < filled > action. < initial > can request user input and handle events. < initial > continues to be visited while its form item variable is undefined and its condition is true. When any of the form’s fields are filled in by user input, then all < initial > form item variables are set to true, before any < filled > actions are executed. Then the form will visit those fields that are still unfilled to complete the form.

<initial
name="String"
expr="ECMAScript_Expression"
cond="ECMAScript_Expression">
child elements
</initial>
nameThe name attribute represents the name of form item variable used. Use this variable if you want to explicitly control the <initial> execution. This attribute is optional and defaults to an inaccessible internal variable.
exprThe expr attribute is the initial value of the form item variable. < initial > will be visited only if the expression evaluates to undefined. This attribute is optional and defaults to undefined.
condThe cond attribute is a Boolean condition that must evaluate to true in order for the <initial> element to be visited. This attribute is optional and defaults to true.
<form>
<audio>, <catch>, <error>, <help>, <link>, <noinput>, <nomatch>, <prompt>, <property>, <value>
None.
None.
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
 <form id="product">
  <grammar type="text/x-grammar-choice-dtmf">
   1 {uno} |
   2 {dos} |
   3 {tres} |
   4 {cuatro} |
   5 {cinco}
  </grammar>
  <block>
   Welcome to the Product Information By Phone.
  </block>
  <initial name="id_product">
   <prompt>Enter the product ID?</prompt>
   <nomatch count="1">
    Please say something like this,
    "1 2 2 3 4".
   </nomatch>
   <nomatch count="2">
    I'm sorry, I still don't understand.
    I'll ask you for information one piece at a time.
    <assign name="id_product" expr="true"/>
    <reprompt/>
   </nomatch>
  </initial>
  <field name="color_product">   
   <prompt>From which city are you leaving?</prompt>
  </field>
  <field name="form_product">
   <prompt>Which city are you going to?</prompt>
  </field>
  <block>
    <prompt>
      You said that you wanted <value expr="color_product"/>
      <value expr="color_product"/>.
    </prompt>
  </block>
 </form>
</vxml>
  • developer_guide/voicexml_references/elements/initial.txt
  • Last modified: 2015/10/27 12:57
  • by borja