> For the complete documentation index, see [llms.txt](https://docs.plumvoice.com/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.plumvoice.com/dev/voicexml/tags/subdialog-tag.md).

# \<subdialog>

## \<subdialog> <a href="#subdialog" id="subdialog"></a>

Subdialogs are a mechanism for reusing common dialogs and building libraries of reusable applications.

### Attributes

<table><thead><tr><th width="203.33333333333331">Name</th><th width="145">Data type<select><option value="3d08951219a54315b36edcc3498cbb3f" label="String" color="blue"></option><option value="69962be26d26488c87dedc92fae23aad" label="Integer" color="blue"></option><option value="2aa5b8b26afb49a99353647d972a720f" label="Boolean" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>name</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>The result returned from the subdialog, an ECMAScript object whose properties are the ones defined in the namelist attribute of the &#x3C;return> element.</td></tr><tr><td>cond</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>(defaults to true) An expression that must evaluate to true after conversion to Boolean in order for the event to be caught.</td></tr><tr><td>expr</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>The initial value of the form item variable; default is ECMAScript undefined. If initialized to a value, then the form item will not be visited unless the form item variable is cleared.</td></tr><tr><td>src</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>The URI of the subdialog.</td></tr><tr><td>srcexpr</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>An ECMAScript expression yielding the URI of the subdialog.</td></tr><tr><td>fetchhint</td><td></td><td>This attribute is not supported.</td></tr><tr><td>fetchtimeout</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>(defaults to “fetchtimeout” global property value) The timeout for fetches. Must be specified with the appropriate time units (e.g., “120s” for 120 seconds).</td></tr><tr><td>maxage</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>(defaults to “documentmaxage” global property value) Tells the platform the maximum acceptable age, in seconds, of cached documents.</td></tr><tr><td>maxstale</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>(defaults to “documentmaxstale” global property value) Tells the platform the maximum acceptable staleness, in seconds, of expired cached documents.</td></tr><tr><td>fetchaudio</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>(defaults to “fetchaudio” global property value) The URI of the audio clip to play while the fetch is being done.</td></tr><tr><td>method</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>(defaults to “get”) The request method: "get", "post", or "raw".</td></tr><tr><td>enctype</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td><p>(defaults to “application/x-www-form-urlencoded”) The media encoding type of the submitted document. Accepted values include the following:</p><ul><li>“multipart/form-data”: used when binary data is being submitted.</li><li>“application/xml”: used for fetching raw XML</li><li>“application/json”: used when fetching raw JSON.</li></ul></td></tr><tr><td>rawexpr</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td>The raw XML or JSON string to submit to the URI. You can only use this attribute when using the “raw” method and either the “application/xml” or “application/json” enctype.</td></tr><tr><td>namelist</td><td><span data-option="3d08951219a54315b36edcc3498cbb3f">String</span></td><td><p>The list of variables to submit. The default is to submit no variables.</p><p></p><p>If a namelist is supplied, it may contain individual variable references that are submitted with the same qualification used in the namelist. Declared VoiceXML and ECMAScript variables can be referenced.</p></td></tr></tbody></table>

### Notes

Exactly one of “src” and “srcexpr” must be specified.&#x20;

When setting the “method” attribute to “post”, the platform does a normal POST with the variables passed in the namelist encoded as “application/x-www-form-urlencoded” or “multipart/form-data”. After encoding the namelist, the platform passes the data and tells the server that the data is encoded with whatever format it used to encode.&#x20;

However, when setting the “method” attribute to “raw”, the “raw” type is still a POST request, but does two things to change the default behavior, allowing control over both the data and the encoding type reported to the server:&#x20;

1. Rather than encoding the namelist to create the “data”, the platform instead executes the rawexpr javascript expression and uses the result for the data.&#x20;
2. It passes the encoding that was provided in the “enctype” attribute as the encoding to the web server.

### Example

{% tabs %}
{% tab title="subdialog.vxml" %}

```markup
<?xml version="1.0"?>
<vxml version="2.1">
  <form>
    <subdialog name="blah" src="subdialog.php"/>
    <block>
      Hello <value expr="blah.stuff"/>.
    </block>
  </form>
</vxml>
```

{% endtab %}

{% tab title="subdialog.php" %}

```php
<?php
     header("Content-type: text/xml");
     echo("<?xml version=\"1.0\"?>\n");
     $somevar = "World";
?>
<vxml version="2.0">
       <form>
         <block>
           <var name="stuff" expr="'<?php echo($somevar)?>'"/>
           <return namelist="stuff"/>
         </block>
       </form>
</vxml>
```

{% endtab %}
{% endtabs %}

The output of the above script would be:

> Computer: Hello World.

### Child Tags

[\<audio>](/dev/voicexml/tags/audio-tag.md), [\<catch>](/dev/voicexml/tags/catch-tag.md), [\<enumerate>](/dev/voicexml/tags/enumerate-tag.md), [\<error>](/dev/voicexml/tags/error-tag.md), [\<filled>](/dev/voicexml/tags/filled-tag.md), [\<help>](/dev/voicexml/tags/help-tag.md), [\<noinput>](/dev/voicexml/tags/noinput-tag.md), [\<nomatch>](/dev/voicexml/tags/nomatch-tag.md), [\<param>](/dev/voicexml/tags/param-tag.md), [\<prompt>](/dev/voicexml/tags/prompt-tag.md), [\<property>](/dev/voicexml/tags/property-tag.md), [\<value>](/dev/voicexml/tags/value-tag.md)

### Parent Tags

[\<form>](/dev/voicexml/tags/form-tag.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.plumvoice.com/dev/voicexml/tags/subdialog-tag.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
