developer_guide:voicexml_references:elements:foreach

no way to compare when less than two revisions

Differences

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


developer_guide:voicexml_references:elements:foreach [2015/10/27 12:36] (current) – created borja
Line 1: Line 1:
 +====== < foreach > ======
  
 +===== Description =====
 +
 +Iterates through an ECMAScript array of items. New in VoiceXML 2.1.
 +
 +===== Syntax =====
 +
 +<code>
 +<foreach
 +array = "ECMAScript_Expression"
 +item = "variable"
 +/>
 +</code>
 +
 +===== Attributes =====
 +
 +|array|An ECMAScript expression that evaluates to an array. Required.|
 +|item|The variable that stores each array item upon each iteration of the loop. Required.|
 +
 +===== Parents =====
 +
 +<code>
 +<block>, <catch>, <error>, <filled>, <foreach>, <help>, <if>, <noinput>, <nomatch>, <prompt>
 +</code>
 +
 +===== Children =====
 +
 +<code>
 +<assign>, <audio>, <break>, <clear>, <data>, <disconnect>, <enumerate>, <exit>, <foreach>, <goto>, <if>, <log>, <prompt>, <reprompt>, <return>, <script>, <submit>, <throw>, <value>, <var>
 +</code>
 +
 +===== Extensions =====
 +
 +<code>
 +None.
 +</code>
 +
 +===== Limitations/Restrictions =====
 +
 +<code>
 +None.
 +</code>
 +
 +===== Example Code =====
 +
 +<code>
 +
 +<?xml version="1.0"?>
 +<vxml version="2.1"
 + xmlns="http://www.w3.org/2001/vxml">
 +   <form id="play_fruit">
 +      <block>
 +         <!-- create an array of fruit names -->
 +         <var name="aFruit" expr="new Array('apples', 'oranges', 'pears', 'bananas')"/>
 +
 +         Here's a list of fruit we have available today
 +
 +         <!-- iterate throught through each item in the array -->
 +         <foreach item="fruit" array="aFruit">
 +            <value expr="fruit"/>
 +         </foreach>
 +      </block>
 +   </form>
 +</vxml>
 +</code>
  • developer_guide/voicexml_references/elements/foreach.txt
  • Last modified: 2015/10/27 12:36
  • by borja