| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| event | Data Type: NMTOKEN | Default: Optional |
| The event attribute specifies the name of the event to throw to the application. As mentioned, either platform defined events, or user-defined events may be indicated in this attribute. Please note that either event or eventexpr may be used within the throw element, but not both. The event name being thrown is accessible in the catch elements shadow variable _event. | ||
| eventexpr | Data Type: CDATA | Default: Optional |
| The eventexpr attribute specifies an ECMAScript expression that evaluates to the event being thrown to the application. As mentioned, either platform defined events, or user-defined events may be indicated in this attribute. Please note that either event or eventexpr may be used within the parent element, but not both. | ||
| message | Data Type: CDATA | Default: Optional |
| The message attribute allows the developer to include a descriptive message along with the event that is being thrown. The message being thrown is accessible in the catch elements shadow variable _message. | ||
| messageexpr | Data Type: CDATA | Default: Optional |
| The messageexpr attribute allows the developer to include an ECMAScript expression resolving to the message being thrown to the application. The messageexpr being thrown is accessible in the catch elements shadow variable _message. | ||
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <var name="EventVar" expr="'AnotherUserDefinedEvent'"/> <catch event="MyUserDefinedEvent"> <prompt> we caught the thrown event. </prompt> <goto next="#F2"/> </catch> <catch event="AnotherUserDefinedEvent"> <prompt> we caught the thrown event expression. </prompt> </catch> <form id="F_1"> <block> <prompt> getting ready to throw an event to be caught. </prompt> </block> <block> <throw event="MyUserDefinedEvent"/> </block> </form> <form id="F2"> <block> <prompt> now throwing an event expression.</prompt> <throw eventexpr="EventVar"/> </block> </form> </vxml> |
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <catch event="MyUserDefinedEvent"> <prompt> <value expr="_message"/>. </prompt> </catch> <form id="F_1"> <block> <prompt> getting ready to throw an event to be caught. </prompt> <throw event="MyUserDefinedEvent" message="'here is the thrown message'"/> </block> </form> </vxml> |
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <var name="MyMsg" expr="'here is the thrown message'"/> <catch event="MyUserDefinedEvent"> <prompt> <value expr="_message"/>. </prompt> </catch> <form id="F_1"> <block> <prompt> getting ready to throw an event to be caught. </prompt> <throw event="MyUserDefinedEvent" messageexpr="MyMsg"/> </block> </form> </vxml> |
| ANNOTATIONS: EXISTING POSTS |
chuchoomar
|
|
| the sistem feels when the user noimput or nomatch automatically?.......so...for instance:
<field> <prompt>Please say a primary color</prompt> <grammar type="application/srgs">red | yellow | blue</grammar> <nomatch> <throw event="event.foo"/> </nomatch> <catch event="event.foo"> <audio src="beep.wav"/> </catch> </field> </form> </vxml> if the user don´t produce a nomatch event the sistem no throw the event nomatch?....and continue with the program ? in fact the sistem jump the nomacth event?......note: is the same with the noimput ? is how if the event was in a conditional? |
|
VoxeoDustin
|
|
| Hey,
Correct, the nomatch/noinput containers and their contents will not be executed unless the system detects these events. Cheers, Dustin |
|
chuchoomar
|
|
|
this is possible? o that don´t have .. throw the event in the same event? <catch event="nomatch" cond="true" count="1"> <throw event"nomatch" message="no has acertado"> <prompt xml:lang="es-es"> <value expr="_message"> </prompt> </catch> |
|
VoxeoDustin
|
|
| Hey,
While this may most likely work, as a best practice, this is a bad idea. A recursive event handler, even with the proper guard conditions, can often cause an infinite loop and should always be avoided. If you need similar functionality, you should throw a separate user defined event within this handler and handle that event separately. Cheers, Dustin |
| login |