Show pageOld revisionsBacklinksExport to PDFBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== < 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:36by borja