submit element
Last Updated: 11-08-2005
VoiceXML 2.0
Obtains a new document via an HTTP GET or POST request.

Syntax

<submit
enctype = "encoding_type"
expr = "ECMAScript_Expression"
fetchaudio = "URI"
fetchaudioexpr = "ECMAScript_Expression"
fetchhint = "string"
fetchtimeout = "string"
maxage = "seconds"
maxstale = "seconds"
method = "string"
namelist = "string"
next = "URI"
/>

Attributes
enctype
The MIME encoding type of the submitted data. To specify the following encodings, you must set the value of the method attribute to "POST", and you must use the namelist attribute to specify the variables to be submitted.
application/x-www-form-urlencoded The data is submitted using the encoding described in Section 2.2 of RFC 1738. This results in name/value pairs sent to the server as name1=value1&name2=value2... with space characters replaced by "+" and reserved characters (like "#") replaced by "%HH" where HH is the ASCII code of the character in hexadecimal. Line breaks are encoded as "%0D%0A" - a carriage return followed by a line feed.
multipart/form-data The data is submitted using the encoding described in RFC 2388. The encoding provides an efficient means for sending large quantities of binary data or text containing non-ASCII characters. When submitting a variable that references recorded audio, the enctype is automatically set to "multipart/form-data".
expr
A ECMAScript expression that evaluates to the URI to which the request is submitted.
fetchaudio
The URI of the audio clip to play while the interpreter fetches the resource. For complete details on the proper use of this attribute, read the fetchaudio tutorial.
fetchaudioexpr
An ECMAScript expression that evaluates to the URI used for fetchaudio. This attribute is a Tellme extension.
fetchhint
Defines when the interpreter context may retrieve documents from the server.
prefetch Documents may be prefetched.
safe Documents may only be fetched when needed, never before.
fetchtimeout
The time in seconds (s) or milliseconds (ms) for the VoiceXML interpreter to wait for content to be returned by the HTTP server before throwing an error.badfetch event. The fetchtimeout value is rounded down to the nearest whole second (e.g., 5700ms or 5.7s would be rounded down to 5s). If fetchtimeout has a value less than 1 second, it is reset to the default value. The default value is 15s.
maxage
Sends the max-age Cache-Control HTTP header along with the request for the specified resource. The header indicates that the document is willing to use content whose age is no greater than the specified time in seconds, unless maxstale is also provided.
Voice application developers should use extreme caution when setting this attribute. If used improperly, it could have an adverse affect on the performance of your application. You should only consider using this attribute in requests for frequently changing content (e.g. dynamically generated content) hosted on a misconfigured HTTP server that you do not control. To reduce load, some HTTP servers are configured to indicate to clients that content expires some arbitrary time in the future. In that case, set the maxage attribute to 0. If you do control the HTTP server, you should instead configure the HTTP server to omit the expires header and possibly to send the Cache-Control: no-cache header. The former requires the VoiceXML interpreter to check with the server before using any cached content. The latter requires the VoiceXML interpreter to not cache the fetched resource.
maxstale
Instructs the VoiceXML interpreter to send a max-stale Cache-Control header along with the HTTP request for the specified resource. The header indicates that the document is willing to use content that has exceeded its expiration time by no more than the specified number of seconds.
Voice application developers should use extreme caution when setting this attribute. If used improperly, your application may present stale content to users. If you do control the HTTP server, you should instead configure the HTTP server to send an expires header with a time in the distant future.
method
The HTTP method used to send the request.
GET The request is submitted using the GET method.
POST The request is submitted using the POST method.
namelist
A space-separated list of variables to be submitted via HTTP to the specified document.
next
The URI to which the request is submitted.

Parents
block, catch, error, filled, foreach, help, if, noinput, nomatch, prompt

Children
None.

Remarks
The next and expr attributes are mutually exclusive.
The namelist, method, and enctype attributes are only relevant if the submit element navigates to a server-side script (e.g. CGI).
The submit element can only be used to navigate to another document. To navigate to a dialog in the current document, use the goto element or the subdialog element.
If you submit any variables that store data returned by the record element, the value of the enctype attribute is forced to multipart/form-data.
If any of the fetchtimeout, fetchhint, maxage, or maxstale attributes is not specified for a submit element, then the value of the fetchtimeout, documentfetchhint, documentmaxage, or documentmaxstale property, respectively, is used.
Prior to revision 3, the interpreter ignores any undeclared variables in the namelist attribute. In revision 3 and later, the interpreter throws error.semantic if any of the variables is undeclared.
Prior to revision 3, if a transition occurs as a result of a submit between an application leaf document and its own application root document, the application root document is not reinitialized. In revision 3 and later, it is.
Examples

The following example requests the name of a subject from the user. The value returned from the grammar is submitted to a CGI script that returns the classes available for that subject.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
  <script>
  <![CDATA[
   var aSubjects = ["overview", "design", "audio", "development", "tuning"];
  ]]>
  </script>

  <form id="get_subject">
    <field name="subject_id">
      <prompt>
        When you hear the name of the subject you want, just say it.
        <foreach item="subject" array="aSubjects">
          <value expr="subject"/>
        </foreach>
      </prompt>

      <grammar src="subjects-voice.grxml" mode="voice" type="application/srgs+xml"/>

      <filled>
        <submit next="classes_by_subject.cgi" namelist="subject_id" />
      </filled>
    </field>
  </form>
</vxml>



[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers