VoiceXML 2.1 Development GuideHome  |  Frameset Home


<filled>  element

The filled element allows the developer to specify actions to take when a grammar match has occurred. Once the interpreter has recognized a valid match specified by the filled elements namelist attribute, the filled element will then execute any code contained within it, (such as a conditional if/else statement).


usage
<filled mode="(any|all)" namelist="NMTOKEN">


attributes
modeData Type: (any|all)Default: Optional (all)
The mode attribute allows the developer to have control of when the filled element executes. If set to ‘any’, then the filled  element will execute as soon as one valid grammar match, specified by the namelist,  has occurred. If set to ‘all’, then every variable namespace defined within the namelist must be filled in order to execute any vxml code contained within the filled element.
namelistData Type: NMTOKENDefault: Optional
The namelist attribute specifies the input namespace that must equate to ‘true’ for the filled element to execute. If a filled element is contained within a form, the namelist attribute will default to the names of the form's field items. If a namelist is specified within a filled element that is contained by an input item, (such as a field), then the interpreter will throw a fatal error.badfetch condition.



shadow variables
none


parents
<field> <form> <record> <subdialog> <transfer>


children
<assign> <audio> <clear> <disconnect> <enumerate> <exit> <goto> <if> <log> <prompt> <reprompt> <return> <script> <submit> <throw> <value> <var>


code samples
<Filled mode> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1">

  <field name="F_1">
    <grammar type="text/gsl"> [ yes (?hell no) (ha ha ha ha ha)] </grammar>
    <prompt> can anyone take john travolta seriously as an actor?</prompt>
      <filled mode="any">
        <prompt> you must have filled but one field </prompt>
      </filled>
  </field>

  <field name="F_2">
    <grammar type="text/gsl">  [yes no (he should be)] </grammar>
    <prompt> do you think don king is ashamed of himself?</prompt>
  </field>

  <filled mode="all">
    <prompt>you must have filled both fields. </prompt>
  </filled>

</form>

</vxml>

<Filled namelist> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>

<form id="F1">

  <field name="F_1">
    <grammar type="text/gsl"> [ (very ?scary) (not very ?scary) (i live in fear)] </grammar>
    <prompt> star trek fans. how scary are they?</prompt>
  </field>


  <field name="F_2">
    <grammar type="text/gsl">  [yes no] </grammar>
    <prompt> oprah and her book club. is actively trying to subvert good taste?</prompt>
  </field>

  <filled namelist="F_1 F_2">
    <prompt>you must have filled both fields. </prompt>
  </filled>

</form>

</vxml>



additional links
W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
shinde_pallavi
4/4/2005 8:58 PM (EDT)
Did not quite understand this: "If a namelist is specified within a filled element that is contained by an input item, (such as a field), then the interpreter will throw a fatal error.badfetch condition."

Could you please give an example?

Thanks!
MattHenry
4/4/2005 10:53 PM (EDT)
An example of this 'bad' code would look something like what we have below. Note that the <filled> tag is nested *within* the <field> itself:

<form>

<field name="F_1">
  <!-- content -->

  <filled namelist="F_1">
  <!-- content -->
  </filled>
</field>

</form>
rajatsabharwal
4/19/2005 9:16 AM (EDT)
Is it possible to include any other tag inside a filled tag after the </if> has been written.
i.e.
<filled>
        <if cond="'rose' == flower">
            <audio>roses are red</audio>
        <elseif cond="'violet' == flower"/>
            <audio>violets are blue</audio>
        <elseif cond="'tulip' == flower"/>
            <audio>tulips come in many colors</audio>
        <else/>     
            <audio>the grass is greener over here.</audio>
        </if>
        IS IT POSSIBLE TO A INSERT A TAG HERE
</filled>


thankx
JimMurphy
4/19/2005 9:53 AM (EDT)
rajatsabharwal,

Yes. It is possible to insert a tag there. Of course, it depends on which tag ;-)

This will tell you which elements are valid child elements of <filled>:
http://docs.voxeo.com/voicexml/2.0/filled.htm

In the example below, I inserted a variable assignment tag which will be executed only when the "flower" variable is filled. My example just defines a sentence that will be read in the next block.

<form id="customersupport">
  <var name="fill_status"/>
    <field name="flower">
      <grammar xmlns="http://www.w3.org/2001/06/grammar"
              xml:lang="en-US"
              root="MYRULE">
        <rule id="MYRULE" scope="public">
          <one-of>
  <item>rose</item>
  <item>violet</item>
  <item>tulip</item>     <item>tree</item>   </one-of>
        </rule>
      </grammar>
      <prompt>
What is your favorite flower?
      </prompt>
      <filled>
<if cond="flower=='rose'">
  <prompt>roses are red</prompt>
<elseif cond="'flower==violet'"/>
  <prompt>violets are blue</prompt>
<elseif cond="flower=='tulip'"/>
          <prompt>tulips come in many colors</prompt>
        <else/>     
  <prompt>the grass is greener over here.</prompt>
</if>
        <assign name="fill_status"
                expr="'Filled Variable. The value was ' + flower"/>
      </filled>
      <goto next="#B1"/>
    </field>
    <block name="B1">
      <prompt>
<value expr="fill_status"/>
      </prompt>
    </block>
  </form>



-----------------
Above, you can see the line:
        <assign name="fill_status"
                expr="'Filled Variable. The value was ' + flower"/>

That appears after the <if>, but within the <filled>.

I hope that helps.

Jim Murphy
Voxeo Customer & Developer Support
support@voxeo.com

Bring your web applications to the phone.
Find out how at http://community.voxeo.com

zazo
1/22/2006 4:53 PM (EST)
Hi

I just have 2 questions ,
first i understand the namelist attribute, but i don't get what is the diffrence in the first example btw any | all

Second question
i belive that when the interprter says i don't reconginze what you have said this like <nomatch> but from where did he get it in the script , is in the engine itself or what ?


thanks in advance
mikethompson
1/22/2006 5:07 PM (EST)
Hey Mohamed,

Check out the description of the mode attribute.  A mode of "any" means that the filled  element will execute as soon as one valid grammar match, specified by the namelist,  has occurred.  So, in the example, as soon as someone responds to the travolta question, the filled element is executed.  The filled element with a mode of all will not be executed unless all the fields have had a valid grammar match.  For example, if you had 4 fields within a form, then all 4 fields would need to be answered to hit a <filled> element at the bottom with a mode of all.

For your second question, yes, the nomatch handler is builtin.  However, if you wanted to use it in a specific scope or in a certain way, simply put it in your script and it will override the internal feature.

Regards,
Mike Thompson
Voxeo Extreme Support
DaveMorris
3/11/2006 6:12 PM (EST)
I see there are Form-level FILLED tags and Field-level FILLED tags.  I have always just used the Form-level tags.  Is the Field-level tag a recommended way to do a verification question on each field of a given form?

For instance, I want to ask for credit card number, and expiration date, and zip code all in the same FORM.  After the caller speaks each one, I want to read it back and ask "is that correct", before going to the next one.  Do you have a sample recommended way to do that?

Thanks,
Dave
mikethompson
3/11/2006 9:34 PM (EST)
Hey Dave,

Check this sample code out.  This will prompt the user for information, take it and then hit a small confirm field where the input will be validated.  From the confirm field, simply direct your application to the next field via the <goto> element.

Hope this helps,
Mike Thompson
Voxeo Extreme Support

<field name="F_1" type="digits?length=3">
<audio src="pickNumber.wav"/>
  <filled>
  <goto nextitem="F_2"/>
  </filled>
</field>



<field name="F_2" type="boolean">
<audio src="confirm.wav"/>
  <filled>
  <if cond="F_2 == true">
    <!-- USER SAID YES -->
  <else/>
    <!-- USER SAID NO -->
    <clear namelist="F_1 F_2"/>
    <goto nextitem="F_1"/>
  </if>
  </filled>
</field>
jefo12
8/12/2008 11:08 PM (EDT)

<form id=F1>
<field name="F_1" type="digits">
<prompt>please enter the number</prompt>

<filled>
<assign name="Id" expr="'123'">
<if cond="F_1=='Id'"/>
<prompt>you are right</prompt>
<else/>
<prompt>pls try again</prompt>
</if>
</filled>

<field>
</form>

what i would like to ask is.Is there any way to restrict the user for only three times.
i mean he should be prompted to 'pls try again' upto three times only after that if he enter wrong then the call should be disconnected.please suggest me.
voxeoJeffK
8/13/2008 3:52 AM (EDT)
Hi Jefo,

One way would be to use the "count" attribute of <catch> like so:

<catch event="wrongAnswer" count="3">
<prompt>You fail!</prompt>
<disconnect/>
</catch>

<form id=F1>
<field name="F_1" type="digits">
<prompt>please enter the number</prompt>

<filled>
<assign name="Id" expr="'123'">
<if cond="F_1=='Id'"/>
<prompt>you are right</prompt>
<else/>
<prompt>pls try again</prompt>
<throw event="wrongAnswer"/>
<clear namelist="F_1"/>
<goto nextitem="F_1"/>
</if>
</filled>

<field>
</form>

hope that helps,
Jeff Kustermann
Voxeo Support

login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site