<initial>
Declares initial logic upon entry into a mixed-initiative form. The <initial> element is a form item that is used to request user input. The following must be true for the <initial> element to be processed:
- The guard variable for the form item must be undefined.
- If the form item specifies a cond attribute, the conditional expression must evaluate to true.
When these conditions exist, the guard condition for the form item is not set, or is considered "unsatisfied."
Note: If any field item variable is set by user input, then all initial form item variables are set to true before any action is performed.
Attributes
This section describes the attributes you can set for this element.
Name |
Data type |
Default |
---|---|---|
CDATA |
optional |
|
CDATA |
optional |
|
CDATA |
““ |
|
NMTOKEN |
optional |
Being a form item, the <initial> element supports the following common form item attributes:
cond
The cond attribute specifies a Boolean expression. This Boolean expression must evaluate to true before the form item is available for selection within the Form Interpretation Algorithm (FIA).
expr
The expr attribute specifies the initial value of the form item variable. The default value of the expr attribute is undefined. If you set the expr attribute to a value other than the default, you will need to clear this value before the content of the form item element can be executed.
inputexpr
The inputexpr attribute allows the VoiceXML interpreter to collect input from the expression rather than gathering it interactively from the caller. This input state behaves exactly as though the caller had spoken the utterance with the exception that the prompt queue is not flushed. The expression can be a String, a waveform, or an "undefined" constant, as follows.
name
The name attribute specifies the name of the form item's guard variable. The Form Interpretation Algorithm (FIA) initializes this variable with the value specified by the expr attribute. If the form item comes up for selection at a later time, it will be populated by the pre-defined type for that element. Since the resulting value is a random constant chosen by the interpreter, it is of no importance. What is important to remember, however, is that the value exists and it's not undefined. The result of the utterance will be available through the field items filled by speaking the form-level grammar.
Children
- Parsed character data
- <audio>
- <catch>
- <enumerate>
- <error>
- <help>
- <link>
- <noinput>
- <nomatch>
- <prompt>
- <property>
- <value>
Parents
Sample code
<form id="weather_info">
<grammar src="../grammars/cityandstate.grxml"/>
<initial name="start">
<prompt> For what city and state would you like the
weather?</prompt>
</initial>
<field name="state">
<prompt> What state? </prompt>
</field>
<field name="city">
<prompt> Please say the city in <value expr="state"/> for
which you want the weather.
</prompt>
</field>
<filled>
<submit next="/servlet/weather" namelist="city state"/>
</filled>
</form>