<catch>

Description

Catches events thrown by the VoiceXML application or the VoiceGenie platform.  The <catch> element associates a catch with a document, dialog (i.e form or menu), or form item.  It contains executable content.

The <catch> element catches an event with a name:

Syntax


<catch event="event1 event2 ..." count="integer" cond="ECMAScript_Expression"> child elements </catch>

Attributes

Attribute

Description

event

The event or events to catch.  A space-separated list of events may be specified to catch multiple events.  The empty string or single dot matches everything. Optional. (Defaults to all events.)

count

The count attribute 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.  When there are more than one <catch> element catching the same event, the element in the closest scope with the highest count that is less than or equal to the current counter will be selected. Optional. (Defaults to 1.)

cond

An ECMAScript expression to be evaluated and used as a boolean condition.  This <catch> element will only catch the event if the expression evaluates to true. Optional. (Defaults to true.)

Anonymous Variables

Two anonymous variables are available within the scope of any <catch> element:

Parents

Field Form Initial Menu Object Record Subdialog Transfer Vxml

Children

Assign Audio Clear Data Disconnect Enumerate Exit ForEach Goto If Log Prompt Reprompt Return Script Submit Throw Value Var #PCDATA

VoiceGenie Extensions

None

Limitations/Restrictions

None

Example


<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form> <field name="field1" type="digits"> <prompt> Please say some digits. </prompt> <catch event="noinput"> I didn't hear you. <reprompt/> </catch> <filled> Thanks. You said <value expr="field1"/>. </filled> </field> </form> </vxml>