Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer_guide:voicexml_references:elements:throw [2015/10/27 21:45] (current)
borja created
Line 1: Line 1:
 +====== < throw > ======
  
 +===== Description =====
 +
 +The <​throw>​ element throws a pre-defined event or application-specific event.
 +
 +===== Syntax =====
 +
 +<​code>​
 +<throw
 +event="​event"​
 +eventexpr="​ECMAScript_Expression"​
 +message="​String"​
 +messageexpr="​ECMAScript_Expression"/>​
 +</​code>​
 +
 +===== Attributes =====
 +
 +|event|The event attribute defines the event name to throw. The attribute is required – specifically the event or eventexpr is required.|
 +|eventexpr|The eventexpr is an expression that yields the event name. The attribute is required – specifically the event or eventexpr is required.|
 +|message|The message attribute indicates a message string providing additional context about the event being thrown. ​ For the pre-defined events thrown by the platform, the value of the message is platform dependent. The message will be available as a variable within the scope of the catch element. This attribute is optional.|
 +|messageexpr|The expression attribute defines the expression that yields the message. This attribute is optional.|
 +
 +===== Parents =====
 +
 +<​code>​
 +<​block>,​ <​catch>,​ <​error>,​ <​filled>,​ <​help>,​ <if>, <​noinput>,​ <​nomatch>​
 +</​code>​
 +
 +===== Children =====
 +
 +<​code>​
 +None.
 +</​code>​
 +
 +===== Extensions =====
 +
 +<​code>​
 +None.
 +</​code>​
 +
 +===== Limitations/​Restrictions =====
 +
 +<​code>​
 +None.
 +</​code>​
 +
 +===== Example Code =====
 +
 +<​code>​
 +<?xml version="​1.0"?>​
 +<vxml version="​2.0"​ xmlns="​http://​www.w3.org/​2001/​vxml">​
 + <​catch event="​goodbye">​
 +  <​prompt>​goodbye.</​prompt>​
 +  <​exit/>​
 + </​catch>​
 + <​form>​
 +  <field name="​hello">​
 +   <​grammar>​hello | goodbye</​grammar>​
 +   <​help>​Just say hello</​prompt>​
 +   <​prompt>​Say hello</​prompt>​
 +   <​noinput>​Say something</​noinput>​
 +   <​filled>​
 +   <​if cond="​hello == '​goodbye'>​
 +    <throw event="​goodbye"/>​
 +   </​if>​
 +   <​prompt>​Hello,​ world!</​prompt>​
 +   </​filled>​
 +  </​field>​
 + </​form>​
 +</​vxml>​
 +</​code>​