<submit>

Generates an HTTP request for a new document and passes a list of variables to the server hosting the requested content.

Attributes

This section describes the attributes you can set for this element.

Name

Data type

Default

enctype

CDATA

application/
x-www-form-urlencoded

expr

CDATA

optional

fetchaudio

CDATA

optional

fetchhint

(prefetch | safe)

optional

fetchtimeout

CDATA

optional

httpheaderlist

ECMAScript expression

optional

maxage

CDATA

optional

maxstale

CDATA

optional

method

(GET | POST)

GET

namelist

CDATA

optional

next

CDATA

optional

enctype

The enctype attribute specifies the MIME-type encoding for a submitted document. The values you can set for this attribute are:

  • application/x-www-form-urlencoded (default)—Data is submitted as specified in the HTML 4.01 Specification. Since this encoding can triple the size of data being submitted and is inefficient in performing encoding on binary data, it is not recommended for binary data such as recordings. Nuance recommends using the multipart/form-data encoding instead.
  • multipart/form-data—Data is submitted as a multi-part MIME document (as defined in RFC 2388). Note that each key has its own part, including separate headers. Nuance recommends using this encoding when submitting binary data such as recordings. 
  • application/octet-stream—Data is submitted as a direct stream of values. Note that keys are not submitted. You can use this encoding to submit a single recording to a file URL, which effectively saves the recording to the specified file. Note that it is possible to separate values on the remote side when submitting multiple items.

expr

The expr attribute generates a URI dynamically from an ECMAScript expression. Note that only one of the next or expr attributes may be specified.

fetchaudio

The fetchaudio attribute specifies the URI of the audio file to play while waiting for a document to be fetched. If you do not specify a setting for the fetchaudio attribute, the <property> element defines a value for the fetchaudio property. If the fetchaudio property is not set (default), no audio is played during a fetch.

fetchhint

The fetchhint attribute determines when content is retrieved from the server. The settings for the fetchhint attribute are prefetch and safe. The prefetch setting indicates that files or dialogs are downloaded when a page is loaded. The safe setting indicates that files or dialogs are downloaded only when they are actually needed.

If you do not specify a setting for the fetchhint attribute, the <property> element determines the setting by defining a value for the appropriate *fetchhint property, for example:

<property name="documentfetchhint" value="safe"/>

fetchtimeout

The fetchtimeout attribute specifies the amount of time to wait for the content to be fetched before throwing an error.badfetch event.

The value may be specified in seconds (s) or milliseconds (ms). If no unit is specified, the value is interpreted as milliseconds by default. If no value is specified, the fetchtimeout defaults to the value set an applicable <property> element, or to the value set for the browser.loading.fetchtimeout property in the Management Station if no <property> applies. If no other default applies, the platform default of 10000 milliseconds is used.

httpheaderlist

The httpheaderlist attribute enables sending custom values in HTTP headers. It specifies an ECMAScript expression that evaluates to an array of headername, headervalue pairs.

Use this mechanism to customize HTTP requests submitted to servers by the Voice Browser service on behalf of VoiceXML applications. It sends runtime information so servers can understand the context of requests and format appropriate responses. Your VoiceXML application (or the voice application server itself) can insert custom values for any purpose. This example assigns httpheaderlist to someHeaders:

var someHeaders = [
     {headername: "Content-Type", headervalue: "text/html; charset=UTF-8"},
     {headername: "custom-hrd1",  headervalue: "custom-value1"}
     ];

One use of custom headers is to identify the current state of the call and enable the VoiceXML application to initiate a relevant action. Another use is to integrate a web server that provides data to the VoiceXML application: for example, to pass information to a server that validates credit cards.

Note: Use this attribute cautiously, and test thoroughly. Do not specify confidential data in the headers unless protected via TLS. In addition, your tests should ensure the server can respond to the custom values. It's best to create new, custom header/value pairs and avoid setting any standard pairs (because the values you specify will override tested defaults).

You must specify headers as an array of header/value pairs. This example creates two custom headers and values and uses httpheaderlist to insert them into a request:

<script><![CDATA[
     function GetHeaders()      {
     var myHeaders = [
          {headername: "CustomHdr1",  headervalue: "Hdr1Value"},
          {headername: "CustomHdr2",  headervalue: "Hdr2Value1 , Hdr2Value2"},
          {headername: "Content-Type", headervalue: "text/html; charset=UTF-8"},
          ];
     return myHeaders;      }
     ]]></script>
     .....
     <form id="get_quote">
          <block>
               <submit name="quote" srcexpr="'http://myserver/account.html"
                    httpheaderlist="GetHeaders()" />
               <assign name="document.quote" expr="quote.documentElement"/>
               ......
          </block>
     </form>
     ......

maxage

The maxage attribute specifies the maximum amount of time a fetched resource may remain in the locale cache without requiring a server revalidation. If a value for the maxage attribute is not specified, revalidation will occur after the expiration of the freshness lifetime (as defined in RFC 2616) .

maxstale

The maxstale attribute specifies the maximum amount of time a stale file remains valid before a refetch is required. If a value for the maxstale attribute is not specified, the stale document is refetched.

method

The method attribute allows you to specify a get or post method for an HTTP request. The default method for an HTTP request is get.

namelist

The namelist attribute specifies the list of variables that are submitted in the query string of a request. If the namelist attribute is not specified, all named field item variables in the current form are submitted.

next

The next attribute specifies the URI for the request. 

Children

None.

Parents

Sample code

<block>
    <if cond="name == null">
        <goto next="#get_personal_info"/>
    <else/>
        <submit next="log_request" method="post" namelist="name
            rank serial_number"/>
    </if>
</block>