<block>

Contains (non-interactive) executable code.

Syntax

 <block
     name="string"
     expr="js_expression"
     cond="js_expression"
 >
   Executable Content
 </block>

Description

Control item container of executable code. As with all form items, a block's form-item variable must have a value of undefined before the block can execute. Just before the block is entered, the interpreter sets its form-item variables to true, so a block is typically executed only once per form invocation.

Attribute Description
name

Name of form-item variable, which may not be a JavaScript reserved keyword. Optional (default is an unusable internal name).

The form-item variable has dialog (form) scope; its name must be unique among all VoiceXML and JavaScript variables within the form's scope.

Generally, you use this attribute only if you want to control block execution explicitly.

expr

JavaScript expression that assigns the initial value of the form-item variable. Optional (default is undefined).

If you set the form-item variable to a value other than undefined, then you'll need to clear it before the block can execute. Note that you need to give the block a name if you want to clear it separately from other form-item variables.

cond

JavaScript boolean expression that must also evaluate to true for the block to execute. Optional (default is true).

If not specified, the value of the form-item variable alone determines whether or not the block can execute.

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.

Usage

Parents Children
<form>
<audio>
<assign>
<bevocal:connect>
<bevocal:dial>
<bevocal:disconnect>
<bevocal:foreach>
<bevocal:hold>
<bevocal:whisper>
<clear>
<data>
<disconnect>
<enumerate>
<exit>
<goto>
<if>
<log>
<prompt>
<reprompt>
<rethrow>
<return>
<script>
<send>
<subdialog>
<submit>
<throw>
<var>
<value>

See Also

 •  VoiceXML 2.0 Specification: <block>

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="foo">
     <block name="hello">
       <prompt>
         Welcome to BeVocal Cafe. It is the best known place
         for Voice X M L Development.
         <audio src="bevocal_chimes.wav" />
       </prompt>
     </block>
   </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