| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| cond | Data Type: CDATA | Default: Optional (true) |
| The cond attribute specifies a Boolean expression, which must equate to ‘true’ in order for the content to be visited and executed. (Additionally, the expr attribute must also be set to ‘undefined’, see below). | ||
| expr | Data Type: CDATA | Default: Optional |
| The expr attribute specifies the initial value of the element; if this value is ‘undefined’, (default), then the element will be visited by the FIA and executed. If this attribute has a value other than ‘undefined’, then the element will not be visited until explicitly set to 'undefined', by use of the clear element. | ||
| name | Data Type: NMTOKEN | Default: Optional |
| The name attribute specifies the name of the ECMAScript form item variable. Each name assigned to an Initial element must be unique, else a fatal error.badfetch will be thrown. | ||
| <?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" xmlns="http://www.w3.org/2001/06/vxml"> <meta name="copyright" content="2012 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <form id="F1"> <grammar xml:lang="en-us" root="TOPLEVEL"> <rule id = "TOPLEVEL"> <item> dummy </item> </rule> </grammar> <initial name="Initial_1" expr="'SomeValue'" cond="false"> <prompt> this Initial form item will be skipped, as the expression is not equal to undefined and the condition is set to false. </prompt> </initial> <block> <goto next="#F2"/> </block> </form> <form id="F2"> <grammar xml:lang="en-us" root = "myrule" mode="dtmf"> <rule id = "myrule" scope = "public"> <item> 1 <tag> out.F_1 = "1" </tag></item> </rule> </grammar> <initial name="Initial_2" cond="true" expr=""> <prompt> this inital form item will get executed, as the expression is set to undefined and the condition is set to true pressing DTMF 1 will execute the enclosed field. </prompt> <nomatch count="1"> <prompt> Okay, I'll ask you for information one piece at a time. </prompt> <assign name="Initial_2" expr="true"/> <reprompt/> </nomatch> <noinput> <prompt> Okay, the quiet type, eh? I'll ask you for information one piece at a time. </prompt> <assign name="Initial_2" expr="true"/> <reprompt/> </noinput> </initial> <field name="F_1"> <prompt> try pressing DTMF 1.</prompt> </field> <filled> <prompt> congratulations, the initial test was successful.</prompt> </filled> </form> </vxml> |
| ANNOTATIONS: EXISTING POSTS |
mtatum111
|
|
| I have a question on the <initial> element.
In the spec it has the following This element controls the initial interaction in a mixed initiative form. Its prompts should be written to encourage the user to say something matching a form level grammar. When at least one input item variable is filled as a result of recognition during an <initial> element, the form item variable of <initial> becomes true, thus removing it as an alternative for the FIA. Does this mean that if something is spoken, then expr="true" which causes the FIA to skip the <initial> on the next pass through? I was a little confused by the statement When at least one input item variable is filled as a result of recognition during an <initial> element, the form item variable of <initial> becomes true, thus removing it as an alternative for the FIA. |
|
mtatum111
|
|
| Also, would expr="true" or "'true'" if a spoken entry was made? | |
voxeoJeffK
|
|
| Hi,
It's not the "expr" that is set to true when a form level grammar match is made, it's the "name", which is the element's variable. Consider: <initial name="startHere"> When the grammar is matched, startHere is assigned the value "true", and the next cycle of the FIA will skip it because the FIA only visits <initial> when its variable is undefined. If your program logic requires an <initial> tag to be revisited all you need do is clear the variable: <clear namelist="startHere"/> And now that will be again selected by the FIA. hope that helps, Jeff K. |
|
mtatum111
|
|
| One more question, as I read the spec, I have come across the following for <initial>
From spec: Note: explicit assignment of values to input item variables does not affect the value of an <initial>'s form item variable. Does this mean that if you have already set input item variables then the <initial> element will still be executed. It sound like this is what it is saying. For instance if we have the following where I have the field input of price set to 100, does this still mean that <initial> will be executed. I believe according to the spec it will. <form id="main"> <var name="price" expr="100"/> <initial> <prompt>I will be collecting the price as well as the number of items. You can say both now. </prompt> </initial> <field name="price" type="currency" /> <prompt>What is the price</prompt> </field> <field name="quantity" type="number" /> <prompt>How many </prompt> </field> |
|
voxeoJeffK
|
|
| Hi,
Yes, you are correct. The <initial>'s form variable is distinct from other input variables. Whether or not the <initial> is visited is not determined by other input items. Jeff K. |
| login |