<if>

Executes actions conditionally.

Syntax

 <if
     cond="js_expression"
 >
   Executable Content
 </if>

Description

Attribute Description
cond

JavaScript expression that evaluates to a boolean value that must be true for the "if" clause to execute. Optional (default is true).

Usage

Parents Children
<bevocal:foreach>
<block>
<catch>
<error>
<filled>
<help>
<if>
<noinput>
<nomatch>
<audio>
<assign>
<bevocal:connect>
<bevocal:dial>
<bevocal:disconnect>
<bevocal:foreach>
<bevocal:hold>
<bevocal:whisper>
<clear>
<data>
<disconnect>
<else>
<elseif>
<enumerate>
<exit>
<goto>
<if>
<log>
<prompt>
<reprompt>
<rethrow>
<return>
<script>
<send>
<subdialog>
<submit>
<throw>
<var>
<value>

Tip:

 •  If a JavaScript expression contains any of the characters "<", ">", or "&", that character must be replaced with the corresponding escape sequence "&lt;", "&gt;", or "&amp;". For more information, see JavaScript Quick Reference.

See Also

 •  VoiceXML 2.0 Specification: <if>
 •  Related tags: <else>, <elseif>

Examples

 <?xml version="1.0" ?>
 <!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
  "http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
 
 <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
   <form id="form">
     <field name="hello">
       <grammar type="application/x-nuance-gsl">
         [one dtmf-1 goodbye]
       </grammar>
       <prompt>Say one or press one to continue or say goodbye to exit.</prompt>
       <nomatch>Sorry, I did not get it.<reprompt/></nomatch>
       <filled>
         <if cond="hello=='one' || hello=='dtmf-1'">
           <prompt> Welcome to this part of the world. </prompt>
         <else/> 
           <prompt> Sorry you could not have much fun. Goodbye </prompt>
         </if>
       </filled>
     </field>
   </form>
 </vxml>

[Show Frames]   [FIRST] [PREVIOUS] [NEXT]
BeVocal, Inc. Café Home | Developer Agreement | Privacy Policy | Site Map | Terms & Conditions
Part No. 520-0001-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL