Last reviewed: 3/23/2024 12:38:47 PM

<subdialog>

A <subdialog> element invokes another dialog as a subdialog of the current one.

Syntax

<subdialog cond="expression"
           enctype="mediaencodingtype"
           expr="expression"
           fetchaudio="uri"
           fetchhint="fetchtype"
           fetchtimeout="secondsormilliseconds"
           maxage="seconds"
           maxstale="methodtype"
           method="seconds"
           name="var"
           namelist="var1 ..."
           src="uri"
           srcexpr="expression" />

Attributes

cond

An expression that must evaluate to true after conversion to boolean in order for the form item to be visited.

enctype

The media encoding type of the submitted document. The default is application/x-www-form-urlencoded.

Media Encoding Type Description
application/x-www-form-urlencoded See Form content types.
multipart/form-data See Form content types.

expr

The initial value of the form item variable. If initialized to a value, then the form item will not be visited unless the form item variable is cleared. The default value is undefined.

fetchaudio

The URI of the audio clip to play while the fetch is being done. If not specified, the fetchaudio property is used, and if that property is not set, no audio is played during the fetch. The fetching of the audio clip is governed by the audiofetchhint, audiomaxage, audiomaxstale, and fetchtimeout properties in effect at the time of the fetch. The playing of the audio clip is governed by the fetchaudiodelay, and fetchaudiominimum properties in effect at the time of the fetch. The default value is the fetchaudio property.

fetchhint

Defines when the interpreter context should retrieve content from the server. If not specified, a value derived from the innermost relevant fetchhint property is used. The default value is the documentfetchhint property

Fetch Type Description
prefetch Indicates a file may be downloaded when the page is loaded.
safe Indicates a file that should only be downloaded when actually needed.

fetchtimeout

The interval to wait for the content to be returned before throwing an error.badfetch event. The value is a Time Designation. The default value is the fetchtimeout property.

maxage

Indicates that the document is willing to use content whose age is no greater than the specified time in seconds. The document is not willing to use stale content, unless maxstale is also provided. If not specified, a value derived from the innermost relevant maxage property, if present, is used. The default value is the documentmaxage property.

maxstale

Indicates that the document is willing to use content that has exceeded its expiration time. If maxstale is assigned a value, then the document is willing to accept content that has exceeded its expiration time by no more than the specified number of seconds. If not specified, a value derived from the innermost relevant maxstale property, if present, is used. The default value is the documentmaxstale property.

method

The request method type. The default value is get.

Method Type Description
get HTTP GET request
post HTTP POST request

name

The result returned from the subdialog, an ECMAScript object whose properties are the ones defined in the namelist attribute of the <return> element.

namelist

The list of variables to submit. The default is to submit no variables.

src

The URI of the subdialog.

srcexpr

An ECMAScript expression yielding the URI of the subdialog.

Children

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

Parents

<form>

Variables

none

Example

The following example illustrates using a subdialog.

<form>
  <subdialog name="result" src="#getdriverslicense">
   <param name="birthday" expr="'2000-02-10'"/>
   <filled>
     <submit next="http://myservice.example.com/cgi-bin/process"/>
   </filled>
  </subdialog>
</form>

<!-- subdialog to get drivers license -->
<form id="getdriverslicense">
  <var name="birthday"/>
  <field name="drivelicense">
   <grammar src="http://grammarlib/drivegrammar.grxml"
      type="application/srgs+xml"/>
   <prompt> Please say your drivers license number. </prompt>
   <filled>
     <if cond="validdrivelicense(drivelicense,birthday)">
       <var name="status" expr="true"/>
     <else/>
       <var name="status" expr="false"/>
     </if>
     <return namelist="drivelicense status"/>
   </filled>
  </field>
</form>

Version Information

Supported in: VoiceXML 1.0, VoiceXML 2.0, and VoiceXML 2.1.