<subdialog>

Invokes a dialog in a new execution context. Control returns to the calling element after the called subdialog executes a return.

Syntax

<subdialog
    cond = "CDATA"
    enctype = "CDATA"
    expr = "CDATA"
    fetchaudio = "URI"
    fetchtimeout = "CDATA"
    fetchhint = "{prefetch | safe}"
    maxage = "CDATA"
    maxstale = "CDATA"
    method = "{get | post}"
    name = "identifier"
    namelist = "list of identifiers"
    src = "URI"
    srcexpr = "CDATA"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

cond

CDATA

no

NA

Boolean expression that must evaluate to ECMAScript true for the <subdialog> element to execute.

enctype

CDATA

no

application/x-www-form-urlencoded

MIME encoding type to use when submitting data to the application server while fetching the subdialog. To submit an audio file that results from a record operation, use enctype="multipart/form-data".

expr

CDATA

no

NA

Initial value of the form item variable.

fetchaudio

URI

no

NA

URI of an audio resource to play while the XML data is fetched. If the fetchaudio attribute is not set, no audio is played during the fetch. If the audio is playing after the XML document is fetched, the audio terminates.

fetchhint

{prefetch | safe}

no

NA

Specifies when the VoiceXML Interpreter context should retrieve content from the server. Valid values:

  • prefetch = Fetch the resource when the page is loaded.

  • safe = Fetch the resource when it is specifically called by the application.

fetchtimeout

CDATA

no

NA

Time interval to wait for the content to be returned before raising an error.badfetch event. Use s for seconds (for example, 1s) and ms for milliseconds (for example, 1ms).

maxage

CDATA

no

NA

Maximum acceptable age, in seconds, of a resource being fetched from the cache. Setting maxage to 0 means that a cached version is never considered fresh.

maxstale

CDATA

no

NA

Maximum acceptable staleness, in seconds, of the resource being fetched, if the fetched resource is cached and expired.

method

{get | post}

no

get

HTTP request method. Valid values:

  • get = Execute an HTTP get.

  • post = Execute an HTTP post.

name

identifier

no

NA

Result returned from the subdialog as an ECMAScript object whose properties are defined in the namelist attribute of the <return> element.

namelist

list of identifiers

no

NA

Space-separated list of variables sent to the subdialog.

src

URI

no

NA

URI of the subdialog.

screxpr

CDATA

no

NA

ECMAScript expression that evaluates to the URI of the subdialog.

Parents

<form>

Children

<audio>, <catch>, <enumerate>, <error>, <filled>, <help>, <noinput>, <nomatch>, <param>, <prompt>, <property>, <value>

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <var name="defaultName"/>
    <form>
        <block>
            Calling the sub dialog
            <assign name="document.defaultName" expr="'Fred'"/>
        </block>
        <subdialog name="subResult" src="#mySubDialog">
            <param name="firstName" expr="document.defaultName"/>
            <param name="lastName" value="Smith"/>
        </subdialog>
        <block>
            After the call to the sub dialog the name is
            <value expr="subResult.firstName"/>
            <value expr="subResult.lastName"/>
        </block>
    </form>
    <form id="mySubDialog">
        <var name="firstName" expr="'Billy'"/>
        <var name="lastName"/>
        <block>
            In the sub dialog
            <value expr="firstName"/>
            <value expr="lastName"/>
            <return namelist="firstName lastName"/>
        </block>
    </form>
</vxml>

See Also

<form>, <return>