<initial>

Control item that specifies the entry logic for a mixed initiative form.

Syntax

<initial
    cond = "CDATA"
    expr = "PCDATA"
    name = "identifier"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

cond

CDATA

no

NA

Boolean expression that must evaluate to ECMAScript true for the <initial> element to execute.

expr

PCDATA

no

ECMAScript undefined

Initial value of the form item variable.

name

identifier

no

NA

Name of the form item variable. This must be a legal ECMAScript identifier.

Details

The <initial> element prompts the user, expecting an utterance matching a form-level grammar to fill multiple fields. When a field is filled by an utterance, all <initial> items in the current form are set. They are not set again unless explicitly cleared.

The <initial> element requires a form-level grammar. Field grammars are not active while the <initial> element executes.

Parents

<form>

Children

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

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <form id="weather_info">
        <grammar src="../../grammar/weatherService.grxml" maxage="0"/>
        <block>
            <prompt bargein="false">
                Welcome to the weather information service.
                <audio src="http://www.online-ads.example/wis.wav"/>
                    Vox pilot develop anywhere deploy everywhere
            </prompt>
        </block>
        <initial name="start">
            <prompt> 
                For what city and country would you like the weather? 
            </prompt>
            <help> 
                Please say the name of the city and country for which you 
                    would like a weather report.
            </help>
        </initial>
        <field name="country">
            <prompt>What country?</prompt>
                <help>
                    Please speak the country for which you want the weather.
                </help>
        </field>
        <field name="city">
            <prompt>
                Please say the city in <value expr="country"/> 
                    for which you want the weather.
            </prompt>
            <help>
                Please speak the city for which you want the weather.
            </help>
        </field>
        <field name="go_ahead" type="boolean" modal="true">
            <prompt>
                Do you want to hear the weather 
                    for <value expr="city"/> 
                    in <value expr="country"/>
            </prompt>
            <filled>
                <if cond="go_ahead">
                    <!-- Servlet example, does not exist -->
                    <submit next="/servlet/weather" method="post" 
                        namelist="city country" fetchtimeout="45s" />
                </if>
                <clear namelist="start city country go_ahead"/>
            </filled>
        </field>
    </form> 
</vxml>
weatherService.grxml:
<?xml version="1.0"?>
<grammar version="1.0" root="weatherservice" 
    xmlns="http://www.w3.org/2001/06/grammar"
    xml:lang="en-gb">
    <rule id="weatherservice">
        <one-of>
            <item>dublin <tag>dublin</tag></item>
            <item>cork <tag>cork</tag></item>
            <item>amsterdam <tag>amsterdam</tag></item>
        </one-of>
    </rule>
</grammar>

See Also

<field>, <form>