Home > Articles > Web Services > XML

  • Print
  • + Share This
Like this article? We recommend

The Field Element

The workhorse element of the form is the field element, which is responsible for capturing a single value. Unlike HTML, in which data validation is done either with embedded JavaScript or handled on the server, VoiceXML fields come with their own validation capability (grammars) as well as the prompts, DTMF sequences, help messages, and other event handlers that are used to obtain the value for the field. When a field variable has been obtained, it may be submitted to a server or copied into other variables.

For convenience, many voice platforms provide a number of built-in common data type grammars that can be accessed by the type attribute. For example, the following will permit the user only to enter or speak a value that can be interpreted as currency (for example, "Ten dollars and fifty cents"):

<field type="currency"/>

Some of the common data types include the following:

  • boolean
  • date
  • digits
  • currency
  • number
  • phone
  • time

If the built-in data types do not satisfy your requirements, then you’ll need to define your own grammar, a rich topic that we’ll explore in more depth later in this and subsequent articles.

  • + Share This
  • 🔖 Save To Your Account