<field>

Description

Declares an input field in a form.  Prompts user for values that match a grammar.

Syntax


<field name="string" expr="ECMAScript_Expression" cond="ECMAScript_Expression" type="boolean" | "currency" | "date" | "digits" | "number" | "phone" | "time" slot="string" modal="boolean" recordutterance="boolean" recordutterancetype="string" utterancedest="string" endbeep="boolean" audioinexpr="ECMAScript_Expression" wakeupword="boolean"> child elements </field>

Attributes

Attribute

Description

name

The name of this field.  This variable holds the matched user input and can be referenced anywhere within the field's form.  Optional. (Defaults to an inaccessible internal variable.)

expr

An ECMAScript expression to be evaluated and used as the initial value of this field.  This field will be visited only if the expression evaluates to undefinedOptional. (Defaults to undefined.)

cond

An ECMAScript expression to be evaluated and used as a boolean condition.  This field will be visited only if the expression evaluates to true.  Optional. (Defaults to true.)

type

Specifies a built-in speech and dtmf grammar for this field.  Optional (an alternative to using speech and dtmf <grammar> elements to specify the built-in grammar).

slot

The name of the grammar slot used to populate the field item variable; usually used for mixed initiative dialogs.  Optional. (Defaults to the field name.)

modal

Set to true if only the field's grammars are to be enabled.  Otherwise, all active grammars are enabled.  Optional. (Defaults to false.)

recordutterance

Set to true to enable recording of user utterances.  Overrides the value of the recordutterance property.  Platform Extension.  Optional. (Defaults to false.)

A platform extension.

recordutterancetype

Specifies the mime type of the recorded utterance, if recordutterance is enabled.  Platform Extension.  Optional. (Defaults to audio/basic.)

A platform extension.

utterancedest

Specifies the path of the directory to use for saved utterance audio files. The value will be resolved relative to the /usr/local/phoneweb/utterance/ or C:\VoiceGenie\mp\utterance\ directory.  Overrides the value of the com.voicegenie.utterancedest property.

Optional.

A platform extension.

endbeep

Specifies whether or not a beep should be played at the end of the prompts.  The beep is treated as any <audio> element.  Platform owners can access the audio file at /usr/local/phoneweb/audio/effects/endofprompt.vox or C:\VoiceGenie\mp\audio\effects\endofprompt.vox (the location can be changed by the vxmli.beep.uri parameter). Overrides the value of the endbeep property.  Optional. (Defaults to false.)

A platform extension.

audioinexpr

An ECMAScript expression which should evaluate to a string that specifies a recording to be used as speech input in this field.  This can specify a complete or relative URI, or a variable reference to a recording (i.e. <record> variable, or $.utteranceaudio shadow variable). See tutorial for details.  Optional.

A platform extension.

wakeupword

Specifies whether or not Wakeup Word Spotting should be used for input in this field.  Overrides the value of the com.voicegenie.wakeupword property.  (Only supported with SpeechWorks OSR.)  Optional. (Defaults to false.)

A platform extension.

Attribute Notes

Shadow Variables

For each <field> whose name attribute is set to <name>, there is a shadow variable <name>$ (in the same scope as the field name variable), containing the following properties:

Property

Description

<name>$.confidence

The recognition confidence level.  Floating point value between 0.0 and 1.0.

<name>$.inputmode

The user input mode. One of dtmf or voice.

<name>$.interpretation

The same value as application.lastresult$.interpretation.)

<name>$.audiooffset

(VoiceGenie extension) Offset of audio data on bargein (-1 if audio was played to the end).  This is undefined if last played prompt was not <audio>.

<name>$.bargein

(VoiceGenie extension) True if bargein occurred, false otherwise.

<name>$.recording

(VoiceXML 2.1 feature) A reference to the recording, or undefined if no audio is collected.  This is only meaningful if the recordutterance  property is set to true.

<name>$.recordingsize

(VoiceXML 2.1 feature) The size of the recording in bytes, or undefined if no audio is collected. This is only meaningful if the recordutterance property is set to true.

<name>$.recordingduration

(VoiceXML 2.1 feature) The duration of the recording, or undefined if no audio is collected. This is only meaningful if the recordutterance property is set to true.

<name>$.markname

(VoiceXML 2.1 feature) The name of the mark last executed by the SSML processor before barge-in occurred or the end of audio playback occurred.  If no mark was executed, this variable is undefined.  This only meaningful when the <field>'s prompts contain at least one <mark> tag.

<name>$.marktime

(VoiceXML 2.1 feature) The number of milliseconds that elapsed since the last mark was executed by the SSML processor, until barge-in occurred or the end of audio playback occurred.  If no mark was executed, this variable is undefined.  This only meaningful when the <field>'s prompts contain at least one <mark> tag.

Shadow Variable Notes

Built-in Types

The following built-in types are supported:

Type

Description

boolean

Grammar for affirmative and negative phrases. Returns true for "yes" (or DTMF equivalent) and false for "no" (or DTMF equivalent).

currency

Grammar for currency amount. The result is a string with the format UUUmm.nn, where UUU is the three character currency indicator according to ISO standard 4217:1995, or mm.nn if the currency is not spoken by the user or if the currency cannot be reliably determined (e.g. "dollar" and "peso" are ambiguous). If the field value is subsequently used in a prompt, it will be spoken as a currency amount appropriate to the current locale.  The set of accepted spoken currency formats is platform dependent and may vary by locale.

date

Grammar for specifying a date. Returns a fixed-length date string format yyyymmdd.  If the year is not specified, yyyy becomes ????; if the month is not specified, mm becomes ??; if the day is not specified, dd becomes ??.

digits

Grammar for a string of digits.  Returns the string of digits.

number

Grammar for numbers.  Returns a string of digits from 0 to 9, and may optionally include a decimal point (".") and/or a plus or minus sign.

phone

Grammar for a phone number. DTMF asterisk "*" represents "x".  The result is a string containing a telephone number consisting of a string of digits and optionally containing the character "x" to indicate a phone number with an extension.  For North America, a result could be "8005551234x789".

time

Grammar for specifying time.  The result is a five character string in the format hhmmx, where x is one of "a" for AM, "p" for PM, "h" to indicate a time specified using 24 hour clock, or "?" to indicate an ambiguous time.  Because there is no DTMF convention for specifying AM/PM, in the case of DTMF input, the result will always end with "h" or "?".

 

The boolean and digits built-in types can be parameterized with the following syntax:

typename?parameter1=value1;parameter2=value2

 

For example, we can assign DTMF equivalents for "yes" and "no" in the boolean type:

<field name="mychoice" type="boolean?y=5;n=6">

Type

Input Parameters

boolean

  • y - the DTMF sequence for an affirmative answer
  • n - the DTMF sequence for a negative answer

digits

  • minlength - minimum number of digits
  • maxlength - maximum number of digits
  • length - exact number of digits

If there is a conflict among these parameters, an error.badfetch event is thrown.

Parents

Form

Children

Audio Catch Enumerate Error Filled Grammar Help Link Noinput Nomatch Option Prompt Property Value #PCDATA

VoiceGenie Extensions

Limitations/Restrictions

None

Example


<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form> <field name="field1" type="boolean"> <prompt> Please say yes or no. </prompt> <filled> You said <value expr="field1"/>. </filled> </field> </form> </vxml>