Differences

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

Link to this comparison view

developer_guide:voicexml_references:elements:var [2015/10/27 21:47] (current)
borja created
Line 1: Line 1:
 +====== < var > ======
  
 +===== Description =====
 +
 +The <var> element declares a variable in the scope of its parent element. ​ If the variable is already defined in the current scope, further declaration is treated as value assignments.
 +
 +===== Syntax =====
 +
 +<​code>​
 +<var
 +name="​String"​
 +expr="​ECMAScript_Expression"/>​
 +</​code>​
 +
 +===== Attributes =====
 +
 +|name|The name attribute defines the name of the variable. This attribute is required.|
 +|expr|The expr attribute is the initial value of the variable. This attribute is optional and defaults to undefined.|
 +
 +===== Parents =====
 +
 +<​code>​
 +<​block>,​ <​catch>,​ <​error>,​ <​filled>,​ <​form>,​ <​help>,​ <if>, <​noinput>,​ <​nomatch>,​ <​vxml>​
 +</​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">​
 + <​var name="​world"​ expr="'​world'"/>​
 + <​form>​
 +  <field name="​hello">​
 +   <​grammar>​hello | goodbye</​grammar>​
 +   <​help>​Just say hello</​prompt>​
 +   <​prompt>​Say hello</​prompt>​
 +   <​noinput>​Say something</​noinput>​
 +   <​filled>​
 +    <​prompt>​Hello, ​
 +     <​value expr="​world"/>​!
 +    </​prompt>​
 +   </​filled>​
 +  </​field>​
 + </​form>​
 +</​vxml>​
 +</​code>​