developer_guide:voicexml_references:elements:assign

< assign >

The <assign> element assigns a value to a variable. It is illegal to make an assignment to a variable that has not been explicitly declared using a <var> element or a <var> statement within a <script>. Attempting to assign an undeclared variable causes an error.semantic event to be thrown.

<assign
name="string"
expr="ECMAScript_Expression"/>
nameThe name of the variable being assigned to. This is required.
exprThe value to assign to the variable. This is required.

In the expr content you can escape special characters (with “\”) : “Bonjour, je suis l\'assistant téléphonique… '”.

<block>, <catch>, <error>, <filled>, <help>, <if>, <noinput>, <nomatch>
None.
None.
None.
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
 <var name="tree" expr="'an apple tree'"/>
 <form>
  <block>
   <prompt> The initial value is <value expr="tree"/> </prompt>
   <assign name="tree" expr="'apple orchards'"/>
   <prompt> The new value is <value expr="tree"/> </prompt>
  </block>
 </form>
</vxml>
  • developer_guide/voicexml_references/elements/assign.txt
  • Last modified: 2017/12/19 09:03
  • by borja