| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| mode | Data 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. | ||
| namelist | Data Type: NMTOKEN | Default: 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. | ||
| <?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> |
| <?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> |
| ANNOTATIONS: EXISTING POSTS |
shinde_pallavi
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
| 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
|
|
|
<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
|
|
| 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 |
|
mtatum111
|
|
| Is there any reason to have <filled> as first element in <form>? I would think that you would have it after or within <field> element.
I had been presented the following question <form> [ 1 ] <field name = "hours_worked" type = "number"> <prompt> What are the number of hours worked? </prompt> [ 2 ] </field> <field name = "days_worked" type = "number"> <prompt> How many days have you worked? </prompt> [3 ] </field> [ 4] </form> Where can the following code be placed to guarantee that the value of hours_worked is greater than 40 when the user answers the prompt "What are the number of hours worked?" (There may be more than one correct answer.) Here I was told the answer is 1,2,4. However, I don't see why the answer would be 2,3,4. Can you let me know what you think? <filled> <if cond = "hours_worked" <= 40"> <clear namelist = "hours_worked"/> </if> </filled> |
|
voxeoJeffK
|
|
| Hi,
The issue here is a matter of scoping. When a <filled> is scoped within a form then by default ALL of that form's input items(such as <fields>) are eligible. In your example placements [1] and [4] would apply here. When you scope a <filled> within an input item like <field> then ONLY that input item's variable is eligible to trigger the <filled>. So placement [2] is valid since it is scoped within the "hours_worked" field. Placement [3] is not valid since it is scoped within the "days_worked" field. Thus the answer is indeed 1,2,4. hope that helps, Jeff K. |
|
mtatum111
|
|
| Jeff, thanks for the information. I understand now about the scoping of the <filled> operator. However, I still do have a question about valid placement of the code. You can have <filled> right after <form> in this case. Is this a case of the FIA determing which operation to do first. For instance, in this example <field> is actually executed first even thouh it is the second element under the <form>? In most cases, I have always seen <filled> come after <field> element - not before it. I guess that is why I am confused.
Thanks for any clarification. <form> <filled> <if cond = "hours_worked" <= 40"> <clear namelist = "hours_worked"/> </if> </filled> <field name = "hours_worked" type = "number"> <prompt> What are the number of hours worked? </prompt> </field> |
|
VoxeoDustin
|
|
| Hey,
Per the form interpretation algorithm, the <filled> will only be processed when an executable block (field, record, transfer, etc) has been satisfied. Therefore this block will be skipped until the relevant field below it has received input from the caller. http://www.w3.org/TR/voicexml20/#dml2.1.6 Thanks, Dustin |
|
mtatum111
|
|
| Dustin, I see what you are saying. Thanks for the info. | |
mtatum111
|
|
| I do have another question about another note on the link that you gave me (http://www.w3.org/TR/voicexml20/#dml2.1.6). We have the following see below. What is the purpose of <reprompt/> being in the catch event "exit" It seems to me that it is of no use as we go to "confirm_exit" and hear the msg there.
For instance does the call sound like this (or am I missing something with <reprompt/>) Hello, you have been called at random to answer questions critical to U.S. foreign policy. Do you agree with the IMF position on privatizing certain functions of Burkina Faso's agriculture ministry Caller says "exit" Then Caller hears You have elected to exit. Are you sure you want to do this, and perhaps adversely affect U.S. foreign policy vis-a-vis sub-Saharan Africa for decades to come <?xml version="1.0" encoding="UTF-8"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd"> <link event="exit"> <grammar type="application/srgs+xml" src="/grammars/exit.grxml"/> </link> <form id="survey_2000_03_30"> <catch event="exit"> <reprompt/> <goto nextitem="confirm_exit"/> </catch> <block> <prompt> Hello, you have been called at random to answer questions critical to U.S. foreign policy. </prompt> </block> <field name="q1"> <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/> <prompt>Do you agree with the IMF position on privatizing certain functions of Burkina Faso's agriculture ministry?</prompt> </field> <field name="q2"> <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/> <prompt>If this privatization occurs, will its effects be beneficial mainly to Ouagadougou and Bobo-Dioulasso?</prompt> </field> <field name="q3"> <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/> <prompt>Do you agree that sorghum and millet output might thereby increase by as much as four percent per annum?</prompt> </field> <block> <submit next="register" namelist="q1 q2 q3"/> </block> <field name="confirm_exit"> <grammar type="application/srgs+xml" src="/grammars/boolean.grxml"/> <prompt>You have elected to exit. Are you sure you want to do this, and perhaps adversely affect U.S. foreign policy vis-a-vis sub-Saharan Africa for decades to come?</prompt> <filled> <if cond="confirm_exit"> Okay, but the U.S. State Department is displeased. <exit/> <else/> Good, let's pick up where we left off. <clear namelist="confirm_exit"/> </if> </filled> <catch event="noinput nomatch"> <throw event="exit"/> </catch> </field> </form> </vxml> |
|
VoxeoDustin
|
|
| Hey,
In that particular example, they are also throwing the exit event on nomatch/noinput. If this event is thrown when a caller says 'exit,' this will do nothing. If it is hit from a nomatch/noinput step, since the field in question is not satisfied, it will return execution to that particular field and replay the prompts. Thanks, Dustin |
|
mtatum111
|
|
| In reviewing the spec and trying to study for my certication test, I have a question about the following snippet of code
<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> According to the 2.0 spec, you can't have mode as an attribute if you are within a field. It says that a bad fetch will be returned. See the last sentence. This is what it says from spec: mode Either all (the default), or any. If any, this action is executed when any of the specified input items is filled by the last user input. If all, this action is executed when all of the mentioned input items are filled, and at least one has been filled by the last user input. A <filled> element in an input item cannot specify a mode; if a mode is specified, then an error.badfetch is thrown by the platform upon encountering the document. |
|
voxeojeremyr
|
|
| Hi,
You are absolutely correct. According to the spec the attribute "mode" cannot be set in an input item such as <field>. However, for our VXML browser we have a conformance setting that is meant to help developers out in cases like this, in which we go ahead and process the <filled> element. If you have any questions, please let us know. Thanks, Jeremy Richmond Voxeo Support |
|
Magician
|
|
| Greetings My Magical Voice Friends.....
I am trying to do some trickery within the <filled> tag: I want to <submit> a recording to a server (using your RecordMessage.asp sample). Then I would like to <goto> another point within my callflow. Here is the problem, it seems that once the submit is run successfully, the call ends without proceeding to the next statement which is the <goto>. If I place the <goto> ahead of the <submit> it will proceed to the next step, of course without running the <submit>. The <submit> is executing. It saves the WAV to the external server. The problem is that it then just abruptly ends the call. The next line, which is the <goto> is not executed. I have trimmed your vxml test code to the minimum necessary to <record> a message and <submit> it to the RecordMessage.asp. This works. Any help finding this rabbit in my hat would be greatly appreciated. Magician |
|
voxeoJeffK
|
|
| Hi,
<submit> completely transfers control to a new document, so you will need to output a new VXML document from the server receiving the <submit>. The server-side code that you have accepting the recording should not just exit. If it outputs a VXML file the voice browser continues on using that new document. hope that helps, Jeff K. |
|
chakri.950
|
|
| Hi,
I am new to Voice XML, I am having few doubts 1. Can we write a field tag without filled tag. 2. Can we write a field without specifying type attribute. 3. Can we write a field tag in foreach loop. because field value should be dynamically generated. Here is my requirement. I would like to prompt the list values with corresponding option (dtmf mode) and corresponding response has to be stored, and that stored value is needed in further code. Thanks in Advance. kalyan |
|
VoxeoDustin
|
|
| Hey Kalyan,
I'll address your questions inline: 1. Can we write a field tag without filled tag. * Yes. The filled tag is not required within a <field>. If no <filled> is specified, execution will move on to the next input or execution item. 2. Can we write a field without specifying type attribute. * Yes. The type attribute is optional and is only necessary to specify a built-in grammar type. When specifying your own grammar, the type attribute is not necessary. 3. Can we write a field tag in foreach loop. because field value should be dynamically generated. * No. Unfortunately, the field tag is not a valid child of foreach. The valid children of foreach are: <assign> <audio> <break> <clear> <data> <disconnect> <enumerate> <exit> <foreach> <goto> <if> <log> <mark> <prompt> <reprompt> <return> <script> <submit> <throw> <value> <var>. If you wish to dynamically generate a field, you will need to employ the use of server-side scripting. I've included a link to the tutorial on integrating server side into your applications below. http://www.vxml.org/intro_serverside.htm Let me know if we can be of further assistance. Cheers, Dustin Hayre Customer Support Engineer 2 Voxeo Support |
|
chakri.950
|
|
| Hi,
Here is my complete requirement. I am having data in session, I can get data into my vxml through some framework. Now, Example:As of now we treat them as static values as below. array/list = ["account number","tax Amount","Interest","delaydate"] Now i have to iterate this array like.. System : Please enter your account number. User : Enters the number (Here is the problem where i faced, I am getting problem how to capture/store this value). System : Please enter your tax amount. User : Enters the amount, same I have to store the user entered value and i have to use it later. similary, all other options also have to be enterd. I am trying different logics from the past 3 days, but i am unable to find the solution . Could you please provide me the solution ASAP. Thanks in Advance Kalyan M |
|
VoxeoDustin
|
|
| Hey Kalyan,
Below is a basic example of this using a JavaScript object. If you wish to do this using an array instead, you would simply create a new Array() and use slots instead of the property names: <?xml version="1.0"?> <vxml version="2.1"> <var name="objUserData" expr="new Object()"/> <form> <field name="getAcctNum" type="digits?length=5"> <prompt> Please enter your account number </prompt> <filled> <assign name="objUserData.acctNum" expr="lastresult$.interpretation"/> </filled> </field> <field name="getTaxAmt" type="digits"> <prompt> Please enter the amount of your tax </prompt> <filled> <assign name="objUserData.taxAmt" expr="lastresult$.interpretation"/> </filled> </field> <field name="confirmData" type="boolean"> <prompt> You entered account number <say-as interpret-as="vxml:digits"> <value expr="objUserData.acctNum"/> </say-as> and tax in the amount of <say-as interpret-as="vxml:number"> <value expr="objUserData.taxAmt"/> </say-as> dollars. Is this correct? </prompt> <filled> <if cond="confirmData"> <prompt> Thanks! </prompt> <else/> <prompt> O K. </prompt> <clear namelist="getAcctNum getTaxAmt"/> </if> </filled> </field> </form> </vxml> Cheers, Dustin Hayre Customer Support Engineer 2 Voxeo Support |
|
chakri.950
|
|
| Hi Dustin,
Thanks for the information it helped me a lot. But Data into the array will come from database. I prefered array because arraysize will vary for various types. For example, under one category there may be 3 fields and in another category there may be only 2 fields. Based on category selection we have to prompt the fields and store field values. So, thing is that we have to dynamically prompt(not an issue) and then user input has to be stored. Storing the values dynamically is the biggest problem for me. I am waiting for the appropriate tag to be used .. |
|
VoxeoDustin
|
|
| Hey Kalyan,
If you wish to dynamic generate content, specifically fields, based on the size of the array, you will certainly need to employ server side scripting to achieve the functionality you desire. Any server side markup should be acceptable as long as it outputs valid VoiceXML. I've included a link below to get you pointed in the right direction. http://www.vxml.org/intro_serverside.htm Let me know if we can be of further assistance. Cheers, Dustin Hayre Customer Support Engineer 2 Voxeo Support |
|
riteshsc
|
|
| Hello,
My code is, <vxml> ........ <form> <field name="pin"> <grammar mode="dtmf" expr="grammarDir + 'grammer.xml'" type="application/grammar-xml"/> .... ..... <filled> <var name="matchedPin" expr="application.lastresult$.utterance"/> <if cond="matchedPin == 'dtmf-*'"> <prompt> Star pressed here <prompt> <elseif cond="matchedPin == 'dtmf-#'"/> <prompt> Pound pressed here <prompt> <else/> <prompt> Other key pressed here <prompt> </if> </filled> </field> </form> I have to check the *,# or other number in if tag with the variable "matchedPin", but it doesn't match using my code. I don't know what is wrong with my code. Please help me to check it. |
|
voxeoJeffK
|
|
| Hello,
The interpretation return will be * or # characters themselves, and not dtmf-* or dtmf-#. So you would test: <if cond="matchedPin == '*'"> Regards, Jeff Kustermann Voxeo Support |
|
riteshsc
|
|
| Thanks for you reply.
I have the code as, <form id="passwordSecurityPresent"> <field name="pin"> <grammar expr="grammarDir + 'passwordSeurityPresentGrammer.xml'" type="application/grammar-xml"/> <prompt> <prompt> <prosody rate="40%"> Enter your PIN if that is you <break time="300"/> </prosody> </prompt> <prompt> <prosody rate="40%"> Press star to pause 15 seconds so you can get john <break time="300"/> </prosody> </prompt> <prompt> <prosody rate="40%"> Press pound or hang up if john is not available <break time="300"/> </prosody> </prompt> <filled> <var name="matchedPin" expr="pin$.interpretation"/> <if cond="matchedPin == '*'"> <prompt> <break time="15000"/> </prompt> <goto next="#passwordSecurityPresent"/> <elseif cond="matchedPin == '#'"/> <goto next="#goodByeForm"/> <else/> <goto next="#dynamicMenuForm"/> </if> </filled> <nomatch> <goto next="#passwordSecurityPresent"/> </nomatch> <noinput> <goto next="#passwordSecurityPresent"/> </noinput> </field> </form> And the grammar is, <?xml version="1.0" encoding="UTF-8"?> <grammar mode="dtmf" tag-format="Nuance" root="Inputs" version="1.0" xmlns="http://www.w3.org/2001/06/grammar"> <rule id="Inputs" scope="public"> <one-of> <item repeat="0-1"> <one-of> <item> * </item> <item> # </item> </one-of> </item> <item repeat="4"> <one-of> <item>0</item> <item>1</item> <item>2</item> <item>3</item> <item>4</item> <item>5</item> <item>6</item> <item>7</item> <item>8</item> <item>9</item> </one-of> </item> </one-of> </rule> </grammar> but still it is going to else block. |
|
voxeoJeffK
|
|
| Hello,
As per our LiveChat, since this is a Nuance browser there will be differences in how it operates. I'll attach the log of our chat for reference. Regards, Jeff Kustermann Voxeo Support |
| login |