<submit>

Performs an HTTP GET or POST with optional variables.

Syntax

<submit
    enctype = "CDATA"
    expr = "CDATA"
    fetchaudio = "URI"
    fetchtimeout = "CDATA"
    fetchhint = "{prefetch | safe}"
    maxage = "CDATA"
    maxstale = "CDATA"
    method = "{get | post}"
    namelist = "list of identifiers"
    next = "URI"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

enctype

CDATA

no

application/x-www-form-urlencoded

MIME encoding type of the submitted document. A MIME type of multipart/form-data must be specified for uploading to the server the audio file that results from a record operation.

expr

CDATA

no

NA

ECMAScript expression that evaluates to the URI of the HTTP request.

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 throwing 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

CDATA

no

get

HTTP request method. Valid values:

  • get = Execute an HTTP get.

  • post = Execute an HTTP post.

namelist

list of identifiers

no

NA

Space-separated list of variables submitted. If no namelist is specified, all named input item variables are submitted.

next

URI

no

NA

URI for the HTTP request.

Parents

<block>, <catch>, <error>, <filled>, <foreach>, <help>, <if>, <noinput>, <nomatch>

Children

None.

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <form id="weather_info">
        <grammar src="../../grammar/weatherService.grxml" maxage="0"/>
        <block>
            <prompt bargein="false">
                Welcome to the weather information service.
                <audio src="http://www.online-ads.example/wis.wav"/>
                    Vox pilot develop anywhere deploy everywhere
            </prompt>
        </block>
        <initial name="start">
            <prompt>For what city and country would you like the weather?</prompt>
            <help>Please say the name of the city and country for which you would 
                like a weather report. </help>
        </initial>
        <field name="country">
            <prompt>What country?</prompt>
            <help>Please speak the country for which you want the weather.</help>
        </field>
        <field name="city">
            <prompt>Please say the city in <value expr="country"/> for which you want
                the weather.</prompt>
            <help>Please speak the city for which you want the weather.</help>
        </field>
        <field name="go_ahead" type="boolean" modal="true">
            <prompt>
                Do you want to hear the weather for <value expr="city"/> in 
                    <value expr="country"/>
            </prompt>
            <filled>
                <if cond="go_ahead">
                    <!-- Servlet example, does not exist -->
                    <submit next="/servlet/weather" method="post" namelist="city country"
                        fetchtimeout="45s" />

                </if>
                <clear namelist="start city country go_ahead"/>
            </filled>
        </field>
    </form>
</vxml>
     
weatherService.grxml:
<?xml version="1.0"?>
<grammar version="1.0" root="weatherservice" 
    xmlns="http://www.w3.org/2001/06/grammar"
    xml:lang="en-gb">
    <rule id="weatherservice">
        <one-of>
            <item>dublin <tag>dublin</tag></item>
            <item>cork <tag>cork</tag></item>
            <item>amsterdam <tag>amsterdam</tag></item>
        </one-of>
    </rule>
</grammar>

See Also

<goto>