# <clear>

Description

Resets one or more form items. It will do the following:

- set the form item variable(s) to ECMAScript `undefined`
- reinitialize the prompt counter and event counters for the form item(s)

To transition back to a single form item variable, without reinitializing the item's prompt and event counters, use `<goto nextitem="itemname"/>`, rather than clearing the item.

To set one or more form item variable(s) back to ECMAScript `undefined`, without reinitializing the items' prompt and event counters, use `<assign name="itemname" expr="undefined"/>` for each item, rather than clearing the item(s).

Syntax

    <clear
        namelist="item1 item2 ..."/>

Attributes

Attribute | Description
namelist | The list of variables to be reset; this can include variable names other than form items, as long as variables are in the current scope. When not specified, all of the form items in the current form are cleared. Optional.

Parents

<block>, <catch>, <error>, <filled>, <foreach>, <help>, <if>, <noinput>, <nomatch>

Children

None.

Extensions

None.

Limitations/Restrictions

- `<clear>` cannot be used as a child of `<foreach>` when `<foreach>` is a child of `<prompt>`.

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"/>.
            Let's try that again.
            <clear namelist="field1"/>
          </filled>
        </field>
      </form>
    </vxml>