# <return>

Description

The `<return>` element completes execution of `<subdialog>` and returns control and data to the calling dialog.

Note: The values returned from a `<subdialog>` can be any ECMAScript values (ex. strings, numbers, pointers, objects, arrays, etc.).

Syntax

    <return
        event="event"
        eventexpr="ECMAScript_Expression"
        namelist="variable1 variable2 ..."
        message="string"
        messageexpr="ECMAScript_Expression"/>

Attributes

Attribute | Description
event | The name of an event to be returned to the calling dialog and thrown. Exactly one of event, eventexpr, or namelist may be specified.
eventexpr | An ECMAScript expression to be evaluated and used as the name of an event to be returned to the calling dialog and thrown. Exactly one of event, eventexpr, or namelist may be specified.
namelist | A space-separated list of variables to be returned to the calling dialog. Exactly one of event, eventexpr, or namelist may be specified. (Defaults to no variables.)
message | A message string providing additional context about the event being thrown. The message will be available as a variable within the scope of the `<catch>` element. Optional. (Can only be used if event or eventexpr is specified; only one of message or messageexpr can be specified.)
messageexpr | An ECMAScript expression to be evaluated and used as the message string, as documented under `message`, above. Optional. (Can only be used if event or eventexpr is specified; only one of message or messageexpr can be specified.)

Parents

<block>, <catch>, <error>, <filled>, <foreach>, <help>, <if>, <noinput>, <nomatch>

Children

None.

Extensions

None.

Limitations/Restrictions

- `<return>` cannot be used as a child of `<foreach>` when `<foreach>` is a child of `<prompt>`.

Example

Document that calls the subdialog:

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <subdialog name="result" src="subdialog.vxml">
          <filled>
            Your account number is <value expr="result.acctnum"/>.
            Your phone number is <value expr="result.acctphone"/>.
          </filled>
        </subdialog>
      </form>
    </vxml>

Document containing the subdialog:

    <?xml version="1.0"?>
    <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
      <form>
        <field name="acctnum" type="digits">
          <prompt> What is your account number? </prompt>
        </field>
        <field name="acctphone" type="phone">
          <prompt> What is your home telephone number? </prompt>
          <filled>
            <return namelist="acctnum acctphone"/>
          </filled>
        </field>
      </form>
    </vxml>