| 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. |
| login |