ZVON > References > VoiceXML Reference
Element:catch
Attributes: | cond | count | event |
Parents: | field | form | initial | menu | object | record | subdialog | transfer | vxml |
Children: | assign | audio | clear | disconnect | enumerate | exit | goto | if | prompt | reprompt | return | script | submit | throw | value | var |
Description:

Go to Standard

Examples:


<catch event="telephone.disconnect"/>


<catch event="help"> Please say visa, mastercard, or amex. </catch>
<help>Please say visa, mastercard, or amex.</help>


<form id="launch_missiles">
     <field name="password">
          <prompt>What is the code word?</prompt>
          <grammar>rutabaga</grammar>
          <help>It is the name of an obscure vegetable.</help>
          <catch event="nomatch noinput" count="3">
               <prompt>Security violation!</prompt>
               <submit next="apprehend_felon" namelist="user_id"/>
          </catch>
     </field>
     <block>
          <goto next="#get_city"/>
     </block>
</form>


<form id="weather_info">
     <block>Welcome to the weather information service.</block>
     <field name="state">
          <prompt>What state?</prompt>
          <grammar src="state.gram" type="application/x-jsgf"/>
          <catch event="help"> Please speak the state for which you want the weather. </catch>
     </field>
     <field name="city">
          <prompt>What city?</prompt>
          <grammar src="city.gram" type="application/x-jsgf"/>
          <catch event="help"> Please speak the city for which you want the weather. </catch>
     </field>
     <block>
          <submit next="/servlet/weather" namelist="city state"/>
     </block>
</form>


<form id="weather_info">
     <block>Welcome to the weather information service.</block>
     <field name="state">
          <prompt>What state?</prompt>
          <grammar src="state.gram" type="application/x-jsgf"/>
          <catch event="help"> Please speak the state for which you want the weather. </catch>
     </field>
     <field name="city">
          <prompt>What city?</prompt>
          <grammar src="city.gram" type="application/x-jsgf"/>
          <catch event="help"> Please speak the city for which you want the weather. </catch>
     </field>
     <block>
          <submit next="/servlet/weather" namelist="city state"/>
     </block>
</form>


<form id="survey_2000_03_30">
     <catch event="exit">
          <goto nextitem="confirm_exit"/>
     </catch>
     <block>
          <prompt> Hello, you have been called at random to answer questions critical to U.S. foreign policy. </prompt>
     </block>
     <field name="q1" type="boolean">
          <prompt>Do you agree with the IMF position on privatizing certain functions of Burkina Faso’s agriculture ministry?</prompt>
     </field>
     <field name="q2" type="boolean">
          <prompt>If this privatization occurs, will its effects be beneficial mainly to Ouagadougou and Bobo-Dioulasso?</prompt>
     </field>
     <field name="q3" type="boolean">
          <prompt>Do you agree that sorghum and millet output might thereby increase by as much as four percent per annum?</prompt>
     </field>
     <block>
          <submit next="register" namelist="q1 q2 q3"/>
     </block>
     <field name="confirm_exit" type="boolean">
          <prompt>You have elected to exit. Are you sure you want to do this, and perhaps adversely affect U.S. foreign policy vis-à-vis sub-Saharan Africa for decades to come?</prompt>
          <filled>
               <if cond="confirm_exit"> Okay, but the U.S. State Department is displeased.
                    <exit/>
                    <else/> Good, let’s pick up where we left off.
                    <clear namelist="confirm_exit"/>
               </if>
          </filled>
     </field>
</form>