# <initial>

Description

Provides the initial prompts, catches, and event counters while waiting for the user to provide form-wide information, in a mixed initiative form.

Unlike `<field>`, `<initial>` has no grammars and no `<filled>` action; `<initial>` can only request user input and handle events. The `<initial>` item continues to be visited while its form item variable is undefined and condition is true. When any of the form's fields are filled 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.

The `<initial>` elements of a form are set to `true` as type Boolean, once one or more of the form's input item variables are set by user input.

Syntax

    <initial
        name="string"
        expr="ECMAScript_Expression"
        cond="ECMAScript_Expression"
        wakeupword="boolean">
      child elements
    </initial>

Attributes

Attribute | Description
name | The name of this initial item. This variable can be referenced anywhere within the initial's form. Use this variable if you want to explicitly control `<initial>` execution. Optional. (Defaults to an inaccessible internal variable.)
expr | An ECMAScript expression to be evaluated and used as the initial value of this initial item. This initial item will be visited only if the expression evaluates to `undefined`. Optional. (Defaults to undefined.)
cond | An ECMAScript expression to be evaluated and used as a boolean condition. This initial item will be visited only if the expression evaluates to `true`. Optional. (Defaults to true.)
wakeupword | Specifies whether or not Wakeup Word Spotting should be used for input in this initial item. Overrides the value of the `com.voicegenie.wakeupword` property. (Only supported with SpeechWorks OSR.) Optional. (Defaults to false.)

Attribute Notes

- An `error` event may be thrown if a reserved ECMAScript word is used as the `name`.

Parents

<form>

Children

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

Extensions

- Added `wakeupword` attribute.

Limitations/Restrictions

None.

Example

Note that the syntax for specifying form-level grammars that can be used with the `<initial>` element depends on whether DTMF or speech grammars are being used, and what ASR engine is being used (with speech grammars). This example uses an ABNF DTMF form-level grammar with the `<initial>` element. It allows the user to enter multiple pieces of information at once (area code + phone number) or to enter a single piece of information (phone number). The collected information will be used to fill the appropriate field(s), and then if the area code field is still unfilled, it will use its specific prompt and grammar to elicit the missing piece of information.

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <dtmf>
          7369731 { number='7369731'; } |
          416 { areacode='416'; } 7369731 { number='7369731'; }
        </dtmf>
        <initial name="start">
          <prompt> Please enter your phone number. </prompt>
        </initial>
        <field name="field1" slot="areacode">
          <dtmf> 416 </dtmf>
          <prompt> Please enter your three-digit area code. </prompt>
        </field>
        <field name="field2" slot="number"/>
        <filled>
          Your phone number is <value expr="field1"/> <value expr="field2"/>.
        </filled>
      </form>
    </vxml>