|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[VXML 2.0] Doubt regarding <clear> namelist tokenHi, I have a doubt regarding the resolution of a variable name
present in the namelist attribute of <clear>. Consider the VXML script given below. <?xml
version="1.0"?> <vxml
version="2.0" xmlns="http://www.w3.org/2001/vxml">
<form>
<field name="pin" type="digits?length=4">
<prompt>Enter your 4 digit pin number?</prompt>
<filled>
<if cond="pin == 9090">
Great! You entered the correct pin number
<else/>
Sorry, Invalid pin - please try again
<clear namelist="pin"/>
</if>
</filled>
</field>
</form> </vxml> Here, if the user input is not 9090, then the <else>
part is executed. In <clear>, the variable name “pin” corresponds
to a form-item name (the current one itself). Hence the <field>’s
input item variable gets reset to undefined and its prompt counter and event
counters get reset (thereby making it eligible for selection in next FIA cycle) Consider the following script with a small modification (A
local variable named pin is defined in the anonymous scope of <filled>) <?xml
version="1.0"?> <vxml
version="2.0" xmlns="http://www.w3.org/2001/vxml">
<form>
<field name="pin" type="digits?length=4">
<prompt>Enter your 4 digit pin number?</prompt>
<filled>
<if cond="pin == 9090">
Great! You entered the correct pin number
<else/>
<var name="pin"
expr="’My local pin number’" />
Sorry, Invalid pin - please try again
<clear namelist="pin"/>
</if>
</filled>
</field>
</form> </vxml> During interpretation of this script, if user input is not
9090, then the <else> part is executed. Here <var> declares a new
local variable named pin. Now while processing <clear namelist=”pin”>,
which variable should get reset – Is it the local variable or the form-item
variable? VXML 2.0 specification says, for <clear>, for each
specified variable name, the variable is resolved relative to the current scope
according to Section 5.1.3 (to remove ambiguity, each variable name in the
namelist may be prefixed with a scope name) So I think, in the second script, the local variable pin
should get reset. If I need the form-item variable to be reset, I should
specify “dialog.pin” in the namelist. Please clarify whether my understanding is correct. Thanks Rajesh |
| Free embeddable forum powered by Nabble | Forum Help |