<field>

Specifies an input field for a form.

Syntax

<field 
    cond = "CDATA"
    expr = "CDATA"
    modal = "{true|false}"
    name = "identifier"
    slot = "identifier"
    type = "{ boolean |  currency |date |digits | number | phone | time}"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

cond

CDATA

no

NA

Boolean expression that must evaluate to ECMAScript true for the <field> element to execute.

expr

CDATA

no

ECMAScript undefined

Initial value of the form item variable.

modal

boolean

no

NA

Grammars to enable. Valid values:

  • true = Only the field's grammars are enabled. All other active grammars are temporarily disabled.

  • false = All active grammars are enabled.

name

identifier

no

NA

Name of a shadow variable or a field item variable that holds the recognition result. Shadow variables are values available from a field item, specified as fieldItemVariableName$.shadowVariable. Supported shadow variables are:

  • name$.bargeintime = Time interval between playback started and bargein occurred, in ms (Programmable Media Platform proprietary).

  • name$.confidence = Confidence level in the recognized result. Valid values range from 0.0 (minimum confidence level) to 1.0 (maximum confidence level).

  • name$.interpretation = ECMAScript variable containing the interpretation of the utterance.

  • name$.inputmode = Mode in which user input was provided. Valid values are either dtmf or voice.

  • name$.recording = Reference to the utterance recorded during recognition, if the input mode was voice; otherwise undefined.

  • name$.recordingsize = Size of the recording in bytes, or undefined if no audio is collected.

  • name$.recordingduration = Duration of the recording in ms, or undefined if no audio is collected.

  • name$.utterance = Raw string of recognized words.

slot

identifier

no

NA

Name of the grammar slot used to populate the variable. If not specified, the value is the field item variable name.

type

{boolean |
currency |
date |
digits |
number |
phone |
time}

no

NA

Name of an internal grammar. Input can be through voice or DTMF. Valid values are:

  • boolean = Recognizes negative or positive responses. Accepts the following parameters:

    • boolean = Default boolean type (no parameters specified). A key press of 1 is the affirmative answer, and a key press of 2 is the negative answer.

    • boolean?y=d = DTMF grammar that treats the key press d as an affirmative answer.

    • boolean?n=e = DTMF grammar that treats the key press e as a negative answer.

  • currency = Recognizes currency amounts; for example, $56.78. The default currency is euro number, which recognizes real numbers; for example, 3.14 or 77. (Not currently supported.)

  • date = Recognizes date formats; for example, YYYYMMDD 20020317. (Not currently supported.)

  • digits = Recognizes the digits 0 through 9.

  • digits?minlength=n = String of at least n digits.

  • digits?maxlength=m = String of at most m digits.

  • digits?length=p = String of exactly p digits.

  • phone = Recognizes telephone numbers; for example, 800-555-1234. (Not currently supported).

  • time = Recognizes hours and minutes; for example, 10:45. (Not currently supported.)

Parents

<form>

Children

<audio>, <catch>, <enumerate>, <error>, <filled>, <grammar>, <help>, <link>, <noinput>, <nomatch>, <option>, <prompt>, <property>, <value>

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <form>
        <field name="sevendigits" type="digits?length=7" modal="true">
            <prompt>Say or type a seven digit number</prompt>
        </field>
        <field name="answer" type="boolean" modal="true">
            <prompt>Answer yes or no</prompt>
        </field>
        <filled namelist="sevendigits answer">
            <prompt>
                Your number was
                <say-as interpret-as="vxml:digits"> 
                    <value expr="sevendigits"/> 
                </say-as>
                <break time="80ms"/> 
                    and you answered <value expr="answer"/> 
                <break time="80ms"/> Bye
            </prompt>
        </filled>
    </form>
</vxml>

See Also

<form>, <initial>