<initial>

<initial>

In a typical mixed initiative form, the <initial> element is visited when the user is initially being prompted for form-wide information, and has not yet entered into the directed mode where each field is visited individually.

Attributes

NameData typeDescription

name

String

The name of a form item variable used to track whether the <initial> is eligible to execute. Default is an inaccessible internal variable.

cond

String

An expression that must evaluate to true after conversion to Boolean in order for the form item to be visited.

expr

String

The initial value of the form item variable. Default is ECMAScript undefined.

If initialized to a value, then the form item will not be visited unless the form item variable is cleared.

Notes

None

Example

<?xml version="1.0"?>
<vxml version="2.0">

  <form>
    <grammar type="application/srgs+xml" root="ROOT" mode="voice">
      <rule id="ROOT">
        <one-of>
          <item>
            Dog
            <tag>
              name="Lassie";age="5";color="brown"
            </tag>
          </item>
          <item>
            Cat
            <tag>
              name="Garfield";age="7";color="orange"
            </tag>
          </item>
        </one-of>
      </rule>
    </grammar>

    <initial>
      <prompt>
        Say either dog or cat.
      </prompt>
    </initial>

    <field name="name"/>
    <field name="age"/>
    <field name="color"/>

    <filled>
      <if cond="name=='Lassie'">
        <prompt>
          The dog's name is <value expr="name"/>.
          He is <value expr="age"/> years old.
          His fur color is <value expr="color"/>.
        </prompt>
        <elseif cond="name=='Garfield'"/>
        <prompt>
          The cat's name is <value expr="name"/>.
          He is <value expr="age"/> years old.
          His fur color is <value expr="color"/>.
        </prompt>
        <else/>
        <prompt>
          I did not understand you.
        </prompt>
      </if>
    </filled>
  </form>
</vxml>

The output of the above script would be:

Computer: Say either dog or cat. Human: Dog. Computer: The dog's name is Lassie. Computer: He is 5 years old. Computer: His fur color is brown.

Child Tags

<audio>, <catch>, <enumerate>, <error>, <help>, <link>, <noinput>, <nomatch>, <prompt>, <property>, <value>

Parent Tags

<form>

Last updated