VoiceXML Forum Community Message Board


Post New Topic  Post A Reply
my profile | register | search | faq | forum home
  next oldest topic   next newest topic
» VoiceXML Forum Community Message Board   » Newbies   » Application Scope Variable is Undefined on Leaf Document

 - UBBFriend: Email this page to someone!    
Author Topic: Application Scope Variable is Undefined on Leaf Document
agatlin
Junior Member
Member # 3417

Rate Member
Icon 1 posted March 15, 2006 08:41 AM      Profile for agatlin   Email agatlin   Send New Private Message       Edit/Delete Post   Reply With Quote 
Here's my issue:

I'm trying to set the value of an application variable that was declared at the top of an app root document of which the value is being set using <assign> futher down the page inside a form filled tag. Then I'm sending it to a validation page as follows.

example: Index.vxml
===================================================
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE vxml PUBLIC '-//Voxpilot/DTD VoiceXML 2.0//EN' 'http://dtd.voxpilot.com/voice/2.0/voxpilot_voicexml-2.0.dtd'>
<vxml version="2.0" application="index.vxml">

<!-- application variable -->
<var name="varName" />

...form...
<field id="fldName">
<filled>
<assign name="varName" expr="fldName">
<goto next="ValidateName.vxml" />
</filled>
</field>
...form...
</vxml>

example: ValidateName.vxml
===================================================

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE vxml PUBLIC '-//Voxpilot/DTD VoiceXML 2.0//EN' 'http://dtd.voxpilot.com/voice/2.0/voxpilot_voicexml-2.0.dtd'>
<vxml version="2.0" application="Index.vxml">

...form...
<block>
<prompt>
The name is <value expr="application.varName" />.
<!--Perform some validation checks.........
......>
</prompt>
<goto next="index.vxml" />
</block>
...form...
</vxml>

===================================================
In the above, the vxml declaration on the leaf doc ValidateName.vxml page sets the "application" attribute to "Index.vxml" so i can use application variable "varName" (set in index.vxml) but the variable evaluates to "undefined". The ValidateName.vxml page transitions back to the Index.vxml page after validation wher i want to use the "varName" application variable again for additional prompts. The problem is that "varName" still evaluates to "undefined".

What am i doing wrong here. Any assistance would be greatly appreciated.

Posts: 3 | Registered: Mar 2006  |  IP: Logged
mheadd
Member
Member # 3181

Member Rated:
4
Icon 1 posted March 15, 2006 12:13 PM      Profile for mheadd   Author's Homepage   Email mheadd   Send New Private Message       Edit/Delete Post   Reply With Quote 
You don�t need to declare an application root document on the root document itself. You only need to reference this root document in leaf documents. See the VXML 2.0 spec Section 1.5.2 (http://www.w3.org/TR/voicexml20/#dml1.5.2).

In addition, to the extent that you are referencing it inaccurately in your root document, you�re actually referencing the wrong file (index.vxml vs. Index.vxml).

I�m not sure if this is causing your problem or not, but you might try removing the �application� attribute on your <vxml> element in your Index.vxml document to see if this changes things. (Some platforms will actually throw an error.semantic if this condition exists.)

You might also look into your logs to see what is happening � these should tell you if variable assignment is happening properly.

Hope this helps.

[ March 15, 2006, 12:23 PM: Message edited by: mheadd ]

--------------------
Mark
VoiceinGov.org
http://www.voiceingov.org

Posts: 55 | Registered: Jun 2005  |  IP: Logged
agatlin
Junior Member
Member # 3417

Rate Member
Icon 1 posted March 15, 2006 02:06 PM      Profile for agatlin   Email agatlin   Send New Private Message       Edit/Delete Post   Reply With Quote 
thank you for you response. the "application=index.vxml" attribute on the application root document was inadvertantly added when drafting the initial post and doesn't exist in the actual vxml code i'm testing so i have ruled that out.

Also, in my test code the case of "Index.vxml" is the same on both application root filename ("Index.vxml") and the leaf doc application attribute value ("Index.vxml") so I have also ruled that out.

I have noticed that when declaring and defining a value for the application variable at the top of the Index.vxml page:

<var name="varName" expr="'Aaron'" />

i can reference the variables on my leaf document without issue. But if i don't set a value when declaring the variable at the top of the page:

<var name="varName" />

and then try to set it's value to a field expression further down the Index.vxml page:

<assign name="varName" expr="fldValue" />
<goto next="ValidateName.vxml" />

the assigned value doesn't get refernced by the leaf document. It remains "undefined"

Still researching.

[ March 15, 2006, 02:08 PM: Message edited by: agatlin ]

Posts: 3 | Registered: Mar 2006  |  IP: Logged


All times are Eastern  
Post New Topic  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | VoiceXML Forum



Powered by Infopop Corporation
UBB.classicTM 6.3.1.2