# \<goto>

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

The `<goto>` element is used to:

* Transition to another form item in the current form.
* Transition to another dialog in the current document.
* Transition to another document.

### Attributes

<table><thead><tr><th width="177.33333333333331">Name</th><th width="146">Data type<select><option value="7aa5dd5694374b4f92969ffdeb2db24e" label="String" color="blue"></option><option value="7817fc74f6554087a37024ac426a9c06" label="Integer" color="blue"></option><option value="3f3a373550914af5a9c0feec0298759f" label="Boolean" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>fetchhint</td><td></td><td>This attribute is not supported.</td></tr><tr><td>fetchtimeout</td><td><span data-option="7aa5dd5694374b4f92969ffdeb2db24e">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="7aa5dd5694374b4f92969ffdeb2db24e">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="7aa5dd5694374b4f92969ffdeb2db24e">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>next</td><td><span data-option="7aa5dd5694374b4f92969ffdeb2db24e">String</span></td><td>The URI to which to transition.</td></tr><tr><td>expr</td><td><span data-option="7aa5dd5694374b4f92969ffdeb2db24e">String</span></td><td>An ECMAScript expression that yields the URI.</td></tr><tr><td>fetchaudio</td><td><span data-option="7aa5dd5694374b4f92969ffdeb2db24e">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>expritem</td><td><span data-option="7aa5dd5694374b4f92969ffdeb2db24e">String</span></td><td>An ECMAScript expression that yields the name of the next form item to visit.</td></tr><tr><td>nextitem</td><td><span data-option="7aa5dd5694374b4f92969ffdeb2db24e">String</span></td><td>The name of the next form item to visit in the current form.</td></tr></tbody></table>

### Notes

Exactly one of “next”, “expr”, “nextitem”, and “expritem” must be specified.

### Example

**gotoexample.php**

{% tabs %}
{% tab title="gotoexample.php" %}

```php
<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
?>
<vxml version="2.0">
  <form id="firstform">
    <block>
      <prompt>
        Jumping to the third form.
      </prompt>
      <!-- A "#" symbol followed by an identifier specifies a -->
      <!-- form or menu ID to jump to. -->
      <goto next="#thirdform"/>
    </block>
  </form>
  <form id="secondform">
    <block>
      <prompt>
        Now jumping to another document.
      </prompt>
      <goto next="newdocument.php"/>
      <disconnect/>
    </block>
  </form>
  <form id="thirdform">
    <field name="firstfield">
    <grammar type="application/x-jsgf">
      1 | 2
    </grammar>
      <prompt>
        Enter 1 to go to the next field. Enter 2 to go to the next form.
      </prompt>
    <filled>
      <if cond="firstfield==1">
        <prompt>
          Jumping to the next field.
        </prompt>
        <goto nextitem="secondfield"/>
      <else/>
        <prompt>
          Jumping to the next form.
        </prompt>
        <goto next="#secondform"/>
      </if>
    </filled>
    </field>
    <field name="secondfield">
    <grammar type="application/x-jsgf">
      1
    </grammar>
      <prompt>
        Enter 1 to go to the next form.
      </prompt>
    <filled>
      <prompt>
        Now jumping to the next form.
      </prompt>
      <goto next="#secondform"/>
    </filled>
    </field>
  </form>
</vxml>
```

{% endtab %}

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

```php
<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
  <form id="main">
    <block>
      <prompt>
        This is a new document.
      </prompt>
    </block>
  </form> 
</vxml>
```

{% endtab %}
{% endtabs %}

The output of the above script would be:

> Computer: Jumping to the third form.\
> Computer: Enter 1 to go to the next field. Enter 2 to go to the next form.\
> Human: (enters DTMF-1)\
> Computer: Jumping to the next field.\
> Computer: Enter 1 to go to the next form.\
> Human: (enters DTMF-1)\
> Computer: Now jumping to the next form.\
> Computer: Now jumping to another document.\
> Computer: This is a new document.

### Child Tags

None

### Parent Tags

[\<block>](/dev/voicexml/tags/block-tag.md), [\<catch>](/dev/voicexml/tags/catch-tag.md), [\<error>](/dev/voicexml/tags/error-tag.md), [\<filled>](/dev/voicexml/tags/filled-tag.md), [\<foreach>](/dev/voicexml/tags/foreach-tag.md), [\<help>](/dev/voicexml/tags/help-tag.md), [\<if>](/dev/voicexml/tags/if-tag.md), [\<noinput>](/dev/voicexml/tags/noinput-tag.md), [\<nomatch>](/dev/voicexml/tags/nomatch-tag.md)


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
