<return>

Returns from a subdialog.

Syntax

 <return
     namelist="variable1 ...">
     event="event"/
     eventexpr="js_expression"
     message="String"
     messageexpr="js_expression"
 />

Description

Causes subdialog's execution context to terminate. You can use the <return> to pass back variable values from the subdialog's execution context and to propagate an event back to the calling dialog (for example, a no-match event).

To propagate an event back to the calling dialog, use the event attribute. For example:

 <return event="nomatch"/>

If <return> is encountered in a dialog that is not executing as a subdialog, an error.semantic event is thrown.

Attribute Description
namelist

Space-separated list of variables to return to the calling dialog. Optional (default is to return no variables).

This attribute can specify any variable currently in scope, both VoiceXML variables and JavaScript variables, including shadow variables and other variables that have not been explicitly declared.

A variable set to a JavaScript object is returned as the entire object; it is not broken into its individual components as happens with variable submission.

event

Return to calling dialog and throw this event.

The values returned with the namelist attribute are available to the calling dialog as properties of the <subdialog> input variable. They can be accessed using the following notation:

 subdialogName.namelistVarible

For example, if a subdialog is invoked with:

 <subdialog name="sub" .../> 

and exited with:

 <return namelist="a"/>

then the return value can be accessed as:

 "sub.a"

Usage

Parents Children
<bevocal:foreach>
<block>
<catch>
<error>
<help>
<noinput>
<nomatch>
<if>
<filled>

None.

Exceptions

 •  error.badfetch - Thrown if both event and namelist attributes are specified.

See Also

 •  VoiceXML 2.0 Specification: <return>
 •  Related tag: <subdialog>

Examples

 <?xml version="1.0" ?>
 <!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
  "http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
 
 <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
   <form id="main">
     <subdialog name="result" src="#subbie">
       <param name="goodbye" value="goodbye"/>
     </subdialog>
 
     <block>
       We're back from the sub dialog.
       Result dot hello equals <value expr="result.hello"/>
       Result dot goodbye equals <value expr="result.goodbye"/>
     </block>
   </form> 
   <form id="subbie"> <!-- This is the subdialog -->
 
     <!-- This variable already has a value, -->
     <!-- so it can't be initialized by caller -->
     <var name="hello" expr="'hello'"/>
 
     <!-- This variable is initialized by caller -->
     <var name="goodbye"/>
     <block>
       This is the sub dialog.
       <return namelist="hello goodbye"/>
     </block>
   </form>  
 </vxml>

[Show Frames]   [FIRST] [PREVIOUS] [NEXT]
BeVocal, Inc. Café Home | Developer Agreement | Privacy Policy | Site Map | Terms & Conditions
Part No. 520-0001-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL