Main Menu
|
Section Menu
|
Syllabus
|
Previous
|
Next |
Filled | Page 7 of 7 |
The <filled> element specifies an action to perform when some combination of fields are filled by user input. It may occur in two places: as a child of the <form> element, or as a child of a field item.
As a child of a <form> element, the <filled> element can be used to perform actions that occur when a combination of one or more fields is filled. For example, the following <filled> element does a cross-check to ensure that a starting city field differs from the ending city field:
<form id="get_starting_and_ending_cities"> <field name="start_city"> <grammar src="http://www.grammars.example/voicexml/city.gram"/> <prompt>What is the starting city?</prompt> </field> <field name="end_city"> <grammar src="http://www.grammars.example/voicexml/city.gram"/> <prompt>What is the ending city?</prompt> </field> <filled mode="any" namelist="start_city end_city"> <if cond="start_city == end_city"> <prompt> You can't fly from and to the same city. </prompt> <clear/> </if> </filled> </form>
If the <filled> element appears inside a field item, it specifies an action to perform after that field is filled in by user input. This is a notational convenience for a form-level <filled> element that triggers on a single field item:
<form id="get_city"> <field name="city"> <grammar src="http://www.ship-it.example/grammars/served_cities.gram"/> <prompt>What is the city?</prompt> <filled> <if cond="city == 'Novosibirsk'"> <prompt> Note, Novosibirsk service ends next year. </prompt> </if> </filled> </field> </form>
After each gathering of the user’s input, all the fields mentioned in the input are set, and then the interpreter looks at each <filled> element in document order (no preference is given to ones in fields vs. ones in the form). Those whose conditions are matched by the utterance are then executed in order, until there are no more, or until one transfers control or throws an event.
Attributes include:
mode | Either all (the default), or any. If any, this action is executed when any of the specified fields is filled by the last user input. If all, this action is executed when all of the mentioned fields are filled, and at least one has been filled by the last user input. A <filled> element in a field item cannot specify a mode. |
---|---|
namelist | The fields to trigger on. For a <filled> in a form, namelist defaults to the names (explicit and implicit) of the form’s field items. A <filled> element in a field item cannot specify a namelist; the namelist in this case is the field item name. |
Main Menu
|
Section Menu
|
Syllabus
|
Previous
|
Next |