3.23 initial
Element type |
initial |
Attributes |
cond | expr | name |
Parents |
form |
Children |
PCDATA | audio | catch | enumerate | error | help | link | noinput | nomatch | prompt | property | value |
Description |
Encloses the form items that are visited by the Form Interpretation Algorithm upon entry into the containing form. After executing an initial block, the interpreter will wait until this initial element's form item variable is set before visiting the next form item in the form. |
DTD
<!ELEMENT initial (%audio; | %event.handler; | link | prompt | property)* > <!ATTLIST initial %item.attrs; >
Language model
Attributes
-
cond : expression = true
A guard condition associated with this form item, written as an ECMAScript expression. This expression must evaluate to true for the Form Interpretation Algorithm to visit this form item.
-
expr : expression = undefined
An ECMAScript expression defining an initial value for this form item. The Form Interpretation Algorithm will visit an initial element only if the expression evaluates to undefined.
-
name : field.name
The name associated with this form item. When the caller fills this form-item, by producing an utterance that matches that item's grammar, the value will be stored in a variable of this name visible from within the containing form element.
Children
-
prompt and audible elements
To be rendered upon visiting this element.
-
link and event.handler elements
These are to be activated while this element is being visited.
-
property elements
These define system properties for the duration of this element.
Examples
Example 3-26 A mixed initiative form using initial and a form-level grammar
<?xml version="1.0" encoding="iso-8859-1"?> <vxml version="1.0"> <var name="docCity" expr="''"/> <var name="docState" expr="''"/> <form id="cityState"> <grammar src="citystate.gram" type="application/jsgf"/> <initial name="getBoth"> <prompt> Say the city and state that you require directory assistance for. </prompt> <nomatch count="1"> <prompt>Need to know the city and state.</prompt> <reprompt/> </nomatch> <nomatch count="2"> <prompt> Please say the city and state you are trying to reach. </prompt> <assign name="getBoth" expr="true"/> </nomatch> <noinput count="1"> <prompt>Say the city and state.</prompt> <reprompt/> </noinput> <noinput count="2"> <prompt> You will now be asked for the city and then the state. </prompt> <assign name="getBoth" expr="true"/> </noinput> </initial> <field name="city"> <prompt>City is?</prompt> <filled><assign name="docCity" expr="city"/></filled> </field> <field name="state"> <prompt>State is?</prompt> <filled><assign name="docState" expr="state"/></filled> </field> <block><goto next="#setting"/></block> </form> <form id="setting"> <block> <prompt> City is set to <value expr="docCity"/> and state is set to <value expr="docState"/>. </prompt> </block> </form> </vxml>