filled

filled element

Specifies an action to perform when the VoiceXML interpreter assigns a value to the named variable of a field, transfer, record, or subdialog element.

Syntax

<filled 
mode = "all_any"
namelist = "space_delimited_list"
/>

Attributes

mode

Determines when a form-level filled element executes.

allIndicates that the contents of the filled element will be executed only when all of the input items specified in the namelist are filled.
anyIndicates that the contents of the filled element will be executed when any of the input items specified in the namelist are filled.

namelist

The input items to trigger on. For a filled element in a form, namelist defaults to the names of all the form's input items. A filled element in an input item cannot specify a namelist; the namelist in this case is the input item name.

Parents

field, form, object, record, subdialog, transfer

Children

assign, audio, break, clear, data, disconnect, enumerate, exit, foreach, goto, if, log element, mark, prompt, reprompt, return, script, submit, throw, value, var

Remarks

The filled element contains executable content that is executed when a user's utterance matches an active grammar. As a child of a form element, the filled element executes content when a combination of one or more input items is filled. As a child of an input item, such as a field, it specifies an action to perform after that input item is filled.

The mode and namelist attributes are only appropriate for a filled element in a form. If a mode or namelist attribute is specified for a filled element in an input item, then the attribute is ignored prior to Revision 3, but in Revision 3 and later, the interpreter throws error.badfetch.

If any input items specified by the namelist do not exist, then prior to revision 3, the interpreter ignores them. In Revision 3 and later, the interpreter throws error.semantic in that situation.

Examples

The following example demonstrates a simple use of the filled element. If a 10-digit phone number is matched, execution proceeds to the CallNumber dialog which dials the number using the transfer element. If any other value is input, it will be rejected as an invalid phone number.The following example references a non-existent external grammar file. The error event catches the error, plays a message to the user, and disconnects.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
   <var name="phone_number"/>

   <form id="GetNumber">
      <field name="phone_number">
         

The following example demonstrates how to take different actions based on the recognized result. The code within the filled element checks the value of test_number. If the number is between one and three, the result is accepted and the user is navigated to the Tellme menu. Otherwise, the user is asked to try again.

A sample transcript for this example follows:

Tellme:

Pick a number between one and three.

Caller:

Four.

Tellme:

Four is not between one and three. Pick a number between one and three.

Caller:

Three.

Tellme:

You said three.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
   <link event="event.exit">
   
   <grammar mode="voice"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0"
         xml:lang="en-US">
      <rule id="root_rule" scope="public">
         <one-of>
            <item>
               quit
            </item>
            <item>
               cancel
            </item>
         </one-of>
      </rule>

   </grammar>

   </link>

   <catch event="event.exit">
      <exit />
   </catch>

   <form>
      <field name="test_number">
         <!-- user may say a valid number or Tellme menu -->
         <grammar src="builtin:digits" />

         <prompt> Pick a number between one and three </prompt>

         <catch event="nomatch noinput">
            <prompt>Sorry. I didn't get that.</prompt>
            <reprompt/>
         </catch>

         <!-- take action dependent upon value -->
         <filled>
            <!-- if it is a valid number ... -->
            <if cond=" parseInt(test_number, 10) &gt;= 1 &amp;&amp;
                        parseInt(test_number, 10) &lt;= 3 ">
               <prompt> You said <value expr="parseInt(test_number, 10)" /> </prompt>
               <!-- implicitly exit interpreter -->

            <!-- otherwise, it must not be valid -->
            <else />
               <prompt> <value expr="test_number"/> is not between one and three </prompt>
               <clear />
            </if>
         </filled>
      </field>
   </form>
</vxml>