====== < field > ======
===== Description =====
The < field > element declares an input field in a form and prompts the user for values that match a grammar.
===== Syntax =====
child elements
===== Attributes =====
|name|The name attribute defines the name of the field item variable that holds the matched user input. This attribute is required.|
|expr|The expr attribute is the initial value of the field item variable. This field will be visited only if the expression evaluates to undefined. This attribute is optional and defaults to undefined.|
|cond|The cond attribute is a Boolean condition that must evaluate to true in order for this field to be visited. This attribute is optional and defaults to true.|
|type|The type attribute specifies a built-in grammar. This attribute is optional and can be used as an alternative to the element.|
|slot|The slot attribute is the name of the grammar slot used to populate the field item variable for mixed initiative dialog. This attribute is optional and defaults to the variable name.|
|modal|The modal attribute is set to true if only the field's grammars are enabled. Otherwise, all active grammars are enabled. This attribute is optional and defaults to false.|
===== Shadow Variables =====
The shadow variable (name$) has the following properties after the field is filled in by user input. These properties are available in object application.lastresult$ as well:
* name$.utterance – a raw string of words that were recognized.
* name$.inputmode – a user input type, either dtmf or voice.
* name$.interpretation – an interpretation for this result.
* name$.confidence – a recognition confidence level. Floating point value between 0 to 1.0.
===== DTMF Built-in types =====
The following built-in types are supported for the DTMF input mode:
boolean
The grammar for affirmative and negative phrases. It returns "true" for yes and "false" for no.
digits
The grammar for a string of digits from spoken or DTMF input. It returns the string of digits.
number
The grammar for numbers. It returns a string of digits from 0 to 9, and may optionally include a decimal point (".") and/or a plus or minus sign.
===== DTMF Built-in type parameters =====
The following built-in type parameters can be parameterized with this syntax:
typename?parameter1=value1;parameter2=value2
For example, we can assign a DTMF sequence for a Boolean type:
|boolean|y - the DTMF sequence for an affirmative answer. n - the DTMF sequence for a negative answer.|
|digits|length - exact number of digits.|
|number|length - exact number of numbers.|
If there is a conflict among these parameters, an error.badfetch event is thrown.
===== ASR Built-in types =====
The built-in types supported depends on the ASR installed and configured. Refer to the ASR provider.
===== Parents =====
===== Children =====
===== Extensions =====
None.
===== Limitations/Restrictions =====
None.
===== Example Code =====