<catch>

The <catch> element associates a catch with a document, dialog, or form item. This element is a specific type of XML Events handler that acts as an observer of its parent element. It contains executable content.

Attributes

event The event or events to catch. A space-separated list of events may be specified, indicating that this <catch> element catches all the events named in the list. In such a case a separate event counter (see "count" attribute) is maintained for each event. If the attribute is unspecified, all events are to be caught.
count (defaults to 1) The occurrence of the event. The count allows you to handle different occurrences of the same event differently. Each <form>, <menu>, and form item maintains a counter for each event that occurs while it is being visited; these counters are reset each time the <menu> or form item's <form> is re-entered. The form-level counters are used in the selection of an event handler for events thrown in a form-level <filled>. Counters are incremented against the full event name and every prefix matching event name; for example, occurrence of the event "event.foo.1" increments the counters associated with handlers for "event.foo.1" plus "event.foo" and "event".
cond (defaults to true) An expression that must evaluate to true after conversion to Boolean in order for the event to be caught.

Notes

The <error>, <help>, <noinput>, and <nomatch> elements are shorthand for types of <catch> elements.


Example

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <block>
      <!-- "myevent" is thrown. Jump to the nearest "catch" for -->
      <!-- the "myevent" event. -->
      <throw event="myevent" message="hello, world!"/>
    </block>
    <!-- The "myevent" event will be caught here. -->
    <catch event="myevent">
      <prompt>
        Caught my event with the following message:
        <break time="1s"/>
        <value expr="_message"/>
      </prompt>
    </catch>
  </form>
</vxml>

The output of the above script would be:

Computer: Caught my event with the following message:
Computer: hello, world!



Child Tags

<audio>, <assign>, <clear>, <disconnect>, <data>, <enumerate>, <exit>, <foreach>, <goto>, <if>, <log>, <prompt>, <reprompt>, <return>, <script>, <submit>, <throw>, <value>, <var>



Parent Tags

<field>, <form>, <initial>, <menu>, <record>, <subdialog>, <transfer>, <vxml>