Home > Articles > Web Services > XML

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

3.18 form

Element type

form

Attributes

id | scope

Parents

vxml

Children

block | catch | error | field | filled | grammar | help | initial | link | noinput | nomatch | object | property | record | script | subdialog | transfer | var

Description

A collection of form items that are to be collected through a dialog with the user according to the Form Interpretation Algorithm.

DTD

<!ELEMENT form
  (%input; | %event.handler; | filled | initial | object | link | 
  property | record | script | subdialog | transfer | %variable;)* >
<!ATTLIST form
  id    ID      #IMPLIED 
  scope %scope; 'dialog' >

Language model


03mod18.gif


Attributes

    id : ID

    The identifier of a form. It allows the form to be a target of a goto, submit, or subdialog element.

    scope : (dialog | document)

    Indicates the scope of this form's grammars. It can be dialog or document which the VoiceXML interpreter will translate to local or global scope.

Children

    filled elements

    These are executed once the form is filled in part or in whole depending on the filled elements' mode and namelist attributes.

    form.items

    These are to be visited according to the Form Interpretation Algorithm.

    grammar elements

    Grammars that are active during the execution of this form.

    link elements

    Links that are active throughout the execution of this form.

    property elements

    These set properties for the duration of the execution of this form.

    script elements

    Scripts to be executed upon entry into this form.

    var elements

    These declare variables that are in scope throughout the execution of this form.

Examples

Example 3-20 Forms and transitioning between forms

<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="1.0">

  <form id="getssn" scope="document">
    <field name="ssn" type="digits">
      <prompt>Enter your nine digit social security number</prompt>
      <filled>
        <if cond="ssn.length != '9'">
          <clear namelist="ssn"/>
          <throw event="nomatch"/>
        </if>
      </filled>
    </field>
    <filled>
      <goto next="#getdob"/>
    </filled>
  </form>

  <form id="getdob" scope="document">
    <field name="dob" type="date">
      <prompt>Enter your date of birth</prompt>
    </field>
    <filled>
      <goto next="#final"/>
    </filled>
  </form>

  <form id="final" scope="document">
    <block>
      <prompt>
        Your social security number
        <value expr="ssn"/>
        and date of birth of
        <value expr="dob"/>
        have been entered.
      </prompt>
    </block>
  </form>

</vxml>
  • + Share This
  • 🔖 Save To Your Account