Events
An event is thrown by the VoiceXML platform for any type of reason, such as a user not responding to an input, not responding correctly, or requesting help, etc. An event is also thrown if there is a semantic error in the VoiceXML document, or when the <throw> element is encountered. The <throw> element generates an event (user-defined or system) and the <catch> element catches the event thrown by the VoiceXML document, dialog, or form item.
< throw > | The < throw > element generates predefined or user-defined events. |
Following is an example of the use of the <throw> element:
<throw event="nomatch"/>
In this case, an event is generated when an input by the user is not recognized as part of the active grammar. The attribute for the <throw> element is event, which defines the event to be thrown.
< catch > | The <catch> element catches the event thrown by the VoiceXML document, dialog, or form item. |
Folowing is an example of the use of the <catch> element:
<catch event="nomatch"/> <throw event="event.password.invalid"/> </catch>
Following is a set of available <catch> elements:
< error > | The < error > catch element catches events of type error. |
< help > | The < help > catch element catches events if no help is available. |
< noinput > | The < noinput > catch element catches events if there was no input by the user. |
< nomatch > | The < nomatch > catches events if an input by the user is not recognized as part of the active grammar. |