VoiceXML 2.1 Development GuideHome  |  Frameset Home


<goto>  element

The goto tag is used to transition application execution to a specific form within the current document, or to an entirely separate document. Additionally, it can transition execution to a a specific form within an entirely separate document.


usage
<goto expr="CDATA" expritem="CDATA" fetchaudio="CDATA" fetchhint="(prefetch|safe)" fetchtimeout="CDATA" maxage="CDATA" maxstale="CDATA" next="CDATA" nextitem="NMTOKEN">


attributes
exprData Type: CDATADefault: Optional
The expr attribute evaluates to an ECMAScript value that defines the target URI. Either expr or next may be specified for the element, but not both.
expritemData Type: CDATADefault: Optional
The expritem attribute denotes an ECMAScript value that equates to the value of the next form item, (such as a field name) to visit. Either expritem or nextitem may be specified, but not both.
fetchaudioData Type: CDATADefault: Optional
The fetchaudio attribute specifies the URI of the .wav file to play to the caller in the event of an extended document fetch. Essentially, while the fetch is being made, it allows the developer to play some filler music to the caller rather than presenting only silence.
fetchhintData Type: (prefetch|safe)Default: prefetch
Fetchhint is used to specify when the resource should be fetched during application execution. The possible values and their descriptions are:

  • prefetch : Begin the resource fetch upon initial document execution

  • safe: Only fetch the resource when it is specifically called in the application


Note that the Voxeo platform will always prefetch content, regardless of what this attribute value is set to. As such, specifying a value is somewhat redundant.
fetchtimeoutData Type: CDATADefault: 5s
The fetchtimeout attribute allows the developer to specify how much time to allow on a fetch before throwing an error.badfetch event. This can be specified globally by using the fetchtimeout property in the application root document. If not specified, it will default to 5 seconds. Also note the strict formatting of this value; if specified, the time value must have the ‘s’ denomination appended to it, else an error.badfetch is thrown:

<goto next="MyPage.vxml” fetchtimeout=”5s”/>
maxageData Type: CDATADefault: Optional
The maxage and maxstale attributes replace the VXML 1.0 caching attribute for compliance to the w3c vxml 2.0 specification. The value for this attribute specifies the maximum acceptable age, in seconds, of the resource in question. However, it is strongly advised not to rely on this attribute for cache-control; caching is always best controlled by the hosting server's response headers. If no headers are specified, then no cache control will be present, regardless of the value set for the maxage and maxstale attributes.
maxstaleData Type: CDATADefault: Optional
The maxage  and maxstale attributes replace the VXML 1.0 caching attribute for compliance to the w3c vxml 2.0 specification. The value for this attribute specifies the maximum acceptable staleness, in seconds, of the resource in question. However, it is strongly advised not to rely on this attribute for cache-control; caching is always best controlled by the hosting server's response headers. If no headers are specified, then no cache control will be present, regardless of the value set for the maxage and maxstale attributes.
nextData Type: CDATADefault: Optional
The next attribute specifies the literal URI, or URI fragment of where to transition the caller. The value can be a full URI:

<goto next=”http://MyServer.com/MyFile.vxml”/>

or a relative URI:

<goto next=”MyFile.vxml”/>

In addition, it can also indicate a particular form within the current document, where the pound sign precedes the form item name:

<goto next=”#AnotherForm”/>

Or lastly, it can indicate a specific form in another document:

<goto next=”AnotherDocument.vxml#AnotherForm”/>
nextitemData Type: NMTOKENDefault: Optional
The nextitem attribute works much like the next attribute, except that it allows the developer to transition the caller to a specific form item within the current document, for example:

<goto nextitem="fieldName"/>



shadow variables
none


parents
<block> <catch> <error> <filled> <help> <if> <noinput> <nomatch>


children
none


code samples
<Goto expr-fetchaudio> sample
<?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"/>/>


<var name="MyGotoVar" expr="'MyNextPage.vxml'"/>

<form id="F1">

  <block>
    <prompt> preparing to go to another document. </prompt>
    <goto expr="MyGotoVar" fetchaudio="MySoundFile.wav"/>
  </block>

</form>

</vxml>

<Goto nextitem-expritem> sample
<?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"/>

<var name="GotoVar" expr="'B_4'"/>

<form id="F1">

  <block name="B_1">
    <prompt> preparing to go to the next form item. </prompt>
    <goto nextitem="B_2"/>
  </block>

  <block name="B_2">
    <prompt> preparing to go to the next form item variable. </prompt>
    <goto expritem="GotoVar"/>
  </block>

  <block name="B_3">
    <prompt> this block will be skipped, and will be the last block executed by the FIA.</prompt>
  </block>

  <block name="B_4">
    <prompt> test successful.</prompt>
  </block>

</form>

</vxml>

<Goto fetchhint-fetchtimeout> sample
<?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">

  <block name="B_1">
    <prompt> preparing to go to another page. </prompt>
    <goto next="AnotherPage.vxml" fetchhint="prefetch" fetchtimeout="10s"/>
  </block>

</form>
</vxml>


<Goto maxage-maxstale> sample
<?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">

  <block name="B_1">
    <prompt> preparing to go to another page. </prompt>
    <goto next="AnotherPage.vxml" maxage="5000" maxstale="5000"
          fetchtimeout="10s"/>

  </block>

</form>
</vxml>




additional links
W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
yana
3/25/2007 11:13 AM (EDT)
Hi,

I have the built-in grammar with number of promts. What way to goto next one if the catch event 404. This is example:
...
<field name="input" type="digits?minlength=1;maxlength=6">
<prompt bargein="false">
  <audio src="one.wav"/>
</prompt>

<catch event="error.badfetch.http.404">
<goto nextitem=?????? >
</catch>
<prompt bargein="true">
  <audio src="two.wav"/>
</prompt>
...
I should to play prompt 'two.wav' anywhere. If this is not grammar case, I use the block element and jump to anothe one. But into grammar I couldn't use it.

Thanks,
Yana


MattHenry
3/25/2007 11:02 PM (EDT)


Hello Yana,

I'm not totally sure that I am understanding all your questions. To address the frst, I'd think that the following would work:

<field name="input" type="digits?minlength=1;maxlength=6">
<prompt bargein="false">
  <audio src="one.wav"/>
</prompt>

<catch event="error.badfetch.http.404">
<assign name="input" expr="'skipMe'"
<goto nextitem="twoBlock">
</catch>

</field>

<block name="twoBlock">
<prompt bargein="true">
  <audio src="two.wav"/>
</prompt>
</block>


Note that the block is outside the field scope, and that we have also set the field var to a value, meaning that it can't be revisitied.


Regards,

~Matthew henry
yana
3/26/2007 9:08 AM (EDT)
Hello,

This solution doesn't help becouse the next wave is out of the field grammar and I need to collect all digits pressed during both of prompts and pass them together.

Thanks,
Yana
MattHenry
3/26/2007 2:58 PM (EDT)


Yana,


I am still not totally sure that I am understanding what you are asking, but I will do my best to provide you with a solution based on how I am interpreting your last comment. If you are looking to play the second prompt in the event that you encounter a 404 error, while within the context of the same form item, then you may try something like this:


<vxml>

<var name="P2" expr="'false'"/>

<form>

<field name="input" type="digits?minlength=1;maxlength=6">
<prompt bargein="false" cond="document.P2== 'false'">
  <audio src="one.wav"/>
</prompt>

<prompt bargein="true" cond="document.P2 =='true'">
  <audio src="two.wav"/>
</prompt>

<catch event="error.badfetch.http.404">
<assign name="document.P2" expr="'true'" />
<goto nextitem="input"/>
</catch>

</field>

</form>

Hope this helps,

~Matt
lambchops7
7/18/2007 2:21 PM (EDT)
Hi,

  Say that I have main.vxml and then I <goto> a file named "Question1.vxml" in another directory called "SIBDQ" with the command "<goto next="SIBDQ/Question.vxml"/>.  Now I'm in the SIBDQ directory, how do reference one folder up and <goto> a form in the min.vxml file?

<goto next="../main.vxml#section">??

  Thanks.

manny
MattHenry
7/18/2007 4:24 PM (EDT)


Manny,

That looks correct to me; is this not working for you?


~Matt
iomodo
11/28/2007 10:36 AM (EST)
hello.
I have some problems useing goto tag. The following code throws some kind of error. I assume the problem is in the simbol "&".  The question is how can I pass two or more atributes?

<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1" >
<form id="smth">
<field name="F0" >
<grammar type="text/gsl">
            [one two]
        </grammar>

  <prompt bargein="true" timeout="1s">
hello. I'm here.
  </prompt>

</field>

<filled namelist="F0">
<if cond="F0=='one'">
<goto next="one.jsp?param1=1"/>

<elseif cond="F0=='two'"/>
<goto next="two.jsp?param1=1¶m2=2"/>

</if>
</filled>
</form>
</vxml>


Thanks,
Iomodo
iomodo
11/28/2007 10:49 AM (EST)
hello again. I have solved the problem. I just replaced & -> &amp;
it works now.
thanks anyway :)
VoxeoBrian
11/28/2007 12:00 PM (EST)
Hello,


Glad to see you were able to resolve the issue by properly escaping the ampersand character.  Please let us know if there is anything else we can do to help. 


Standing by,

Brian
MattHenry
2/4/2008 5:58 PM (EST)

One point of confusion that comes up when using fetchaudio is how this affects prompt queuing and document fetching. Note that prompt queueing and prompt execution are two entirely separate hings, and it is strongly advised that developers who are interested in this topic closely read the specification for clarity on the difference:

http://www.w3.org/TR/voicexml20/#dml4.1.8


As this topic has come up a few times, it seemed as if we should illustrate this in a little greater detail, so here goes:

When you declare the fetchaudio property, this will clear the prompt queue, and thus play the <prompt> within your block that does the submit prior to the submission. One thing that is important to remember here is that this can cause some confusion when executing TTS and audio resources. For instance, assume the following document that submits data:


<form>
<field name="F1"> 
  <audio src="audio_1.wav"/>
  ..
  <filled>
  <audio src="standby.wav"/>
  <submit next="target.jsp" namelist="F1" fetchaudio="pulse.wav"/>
  </filled>
</block>
</form>


And further take into account that the XML output of "target.jsp" looks like this:


<form>
<block name="B2">
  <audio src="audio_2.wav"/>
  <exit/>
</block>
</form>


The chronological order of audio execution in this case will be as follows:

1) audio_1.wav
2) user input is gathered
3) standby.wav
4) document fetch occurs
5) pulse.wav (fetchaudio)
6) audio_2.wav

But what happens is we take out the 'fetchaudio' attribute from the <submit> in our invoking document? Here is where things get a little confusing, but bear in mind that this order of execution is per the specification:

1) audio_1.wav
2) user input is gathered
3) document fetch occurs
4) standby.wav
5) audio_2.wav

I hope that this will help to proactively save some time & frustration for our developers as applications are in the formative stages, rather than finding out about this at the last minute.


~Matt

tieuvodanh
4/30/2008 11:24 PM (EDT)
Dear,

How could we goto another field in another form?
For example,

<form id="1">
<block>
<goto f2  (both <goto nextitem = "f2" and <goto next=#2.f2 didn't work

<form id="2">
<field name="f1">
<field name="f2">

Thank you very much
voxeoblehn
5/1/2008 12:24 AM (EDT)
Hello,

As per the spec you cannot <goto> another field from a form. You will only be able to <goto> another form, document, or form within another document. Hope this helps and if we can be of further assistance, please feel free to contact us.

Cheers,

Brian Lehnen
Voxeo Support
jaffar
6/16/2008 5:58 AM (EDT)
<form id="pickcity"
<field name="city">

<prompt>
please select the city do u want.
</prompt>

<grammar type="text.sgl">
[hyderabad bombay delhi [madras chennai] calcutta]
</grammar>

<option>hyderabad></option>
<option>bombay</option>
<option>delhi</option>
<option>calcutta</option>
<option>chennai</option>

<catch event="help nomatch noinput">
your options are <enumerate/>
<prompt>you say <value expr="city"/></prompt>
<block>
<submit next="mypage.jsp" method="post"/>
</block>
</field>
</form>
<form id="movies">
<field name="movie">
<block>
<goto next="#pickcity">
</block>
-------------------------\
In the above vxml application if i want to go from form "movies" to form "cities" using goto and in "cities" i need upto <block> element and i dont want to submit it to the jsp page ....
is it possible....? plz giv me suggestion...
voxeojeremyr
6/16/2008 7:48 AM (EDT)
Hi Jaffar,

I am not sure I understand your question.  In the "cities" form you will probably need a filled element so that you can play back to the caller the city that they selected. 

I don't understand what you mean when you say that you want to go from "movies" to "cities" without doing the submit to the jsp.  If you would give us a little more information, we should be able to help you out.

Thanks,
Jeremy Richmond
Voxeo Support
feel012
9/7/2008 10:45 PM (EDT)
Hi~
I have a question...
I want a goto using varible.
I thought first that is possible to use double tag..
for example..
<goto next="#<value expr="document.AA"/>"/>
but It occured error..
please help me...
voxeoblehn
9/7/2008 11:54 PM (EDT)
Hello,

If I am understanding you correctly you are looking to assign a document to a variable and then reference it via the <goto> tag? If that is indeed what you are looking to do, you would want to declare your variable and call it like so:

I have bolded the relevant code.

[code]
<?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"/>/>


[b]<var name="MyGotoVar" expr="'MyNextPage.vxml'"/>[/b]

<form id="F1">

  <block>
    <prompt> preparing to go to another document. </prompt>
    <goto [b]expr="MyGotoVar"[/b] fetchaudio="MySoundFile.wav"/>
  </block>

</form>

</vxml>
[/code]

I pulled this directly from our documentation on the <goto> element, which can be found here:

http://docs.voxeo.com/voicexml/2.0/goto.htm

The complete code example can be found there as well. I hope you find this helpful, and if we can be of any further assistance, please do not hesitate to contact us.

Regards,

Brian L.
Voxeo Support

feel012
9/9/2008 9:29 PM (EDT)
Hi~ Brian
Thank you for your time and help. You are helping me a lot. Thank you.
bpcamac
11/20/2008 6:18 PM (EST)
The documentation above says that the Voxeo platform will always prefetch the URI regardless of the fetchhint value.

Why?  Why not follow the requirements of the standard?

Such deviation from the spec has a direct impact on our application.  We have an instance where the target of the goto element is a VXML page different from the one being processed, and its dynamically generated.  Pre-fetching this page would result in its content being inaccurate because of the state the application is in at that time, whereas if it is fetched when the goto element is encountered during the normal course of document processing (i.e. with fetchhint=safe) then the content will be valid.

I'm perplexed as to why Voxeo has steered away from the spec on this issue, especially when such deviation takes functionality away from the developer - and apparently for no reason.

- Brenton
voxeojeremyr
11/21/2008 8:45 AM (EST)
Hi Brenton,

Sorry for any confusion.  The 'fetchint' attribute only applies to static content. The <goto> element can, in fact, be used to fetch dynamic content and this data will only be fetched when execution of the document has reached this point.

I am going to let the keepers of our documentation know of this omission as we should be more clear in that statement.

Let me know if you have any further questions.

Thanks,
Jeremy Richmond
Voxeo Support

login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site