Table of Contents

< subdialog >

Description

The <subdialog> element invokes another dialog as a subdialog of the current one. The subdialog is a reusable dialog that allows values to be returned. The subdialog executes in a new execution context with all variables and execution states initialized. Values can be passed into the subdialog using <param> child elements; the subdialog must contain the <var> variable declaration for each parameter. The original dialog can continue execution only when the subdialog executes the <return> element. Returned values are available as properties of the <subdialog> field item variable.

Syntax

<subdialog
name="String"
expr="ECMAScript_Expression"
cond="ECMAScript_Expression"
namelist="variable1 variable2 ..."
src="URI"
method="get" | "post"
enctype="application/x-www-form-urlencoded" | "multipart/form-data"
fetchaudio="URI"
fetchhint="prefetch" | "safe"
fetchtimeout="time_interval"
maxage="time_interval"
maxstale="time_interval">
</subdialog>

Attributes

nameThe name attribute defines the name of the field item variable for the <subdialog> element. The returned results can be retrieved as a property of the variable, name.returnVariable. This attribute is required.
exprThe expr attribute is the initial value of the form item variable. The <subdialog> element will be visited only if the variable is undefined. This attribute is optional and defaults to undefined.
condThe cond attribute is a Boolean expression that must evaluate to true for the <subdialog> to execute. This attribute is optional and defaults to true.
namelistThe namelist attribute is a space-separated list of variables to submit. This attribute is optional and defaults to nothing.
srcThe src attribute is the URI of the <subdialog>. This attribute is required - specifically either src or srcexpr is required.
methodThe method attribute specifies the query request method, get or post. This attribute is optional and defaults to get.
enctypeThe enctype attribute defines the MIME encoding of the document. This attribute is optional and defaults to application/x-www-form-urlencoded. The following types are supported:
* application/x-www-form-urlencoded.
* multipart/form-data (to post recorded messages).
fetchaudioThe fetchaudio attribute is the URI of the audio to play while waiting for the next document to be fetched.
fetchtimeoutThe fetchtimeout attribute is the time interval to wait for the audio file to be fetched before playing the alternate content. This attribute is optional.
fetchhintThe fetchhint attribute defines when the audio file should be retrieved. This attribute is optional.
* prefetch – the audio file may be downloaded when the page is loaded.
* safe – the audio file loads only when needed.
maxageThe maxage attribute indicates the maximum time in seconds that this document will use this subdialog file before fetching another copy. This attribute is optional.
maxstaleThe maxstale attribute indicates the maximum time in seconds that this document will use a subdialog file that exceeded the maxage time. This attribute is optional.

Parents

<form>

Children

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

Extensions

None.

Limitations/Restrictions

The variables submitted to the <subdialog> element in the namelist attribute may not be objects.

Example Code

The following is an example of a document that calls the <subdialog>:

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

The following is an example of a document containing the <subdialog>:

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
 <form id="basic">
  <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>   <prompt> What is your home telephone number? </prompt>
   <filled>
    <return namelist="acctnum acctphone"/>
   </filled>
  </field>
 </form>
</vxml>