ecmascript error on substr attempt
Posted: Wed May 02, 2007 2:32 pm
I want to use substr to pick off the "3" in "13" contained in "quizno" & use it as an index to retrieve & speak the value "four" from the array.
I am getting the following error...
VXI::var_element(name="quiz_ans" expr = "subd.myarray[quizno.substr(1)]")
errmsg TypeError: quizno.substr is not a function line 1 linetxt tokentxt
received event: error.semantic.ecmascript
I am getting the following error...
VXI::var_element(name="quiz_ans" expr = "subd.myarray[quizno.substr(1)]")
errmsg TypeError: quizno.substr is not a function line 1 linetxt tokentxt
received event: error.semantic.ecmascript
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
<form id="caller">
<var name="quizno" expr="13"/>
<subdialog name="subd" src="#callee">
</subdialog>
<block>
<var name= "quiz_ans" expr="subd.myarray[quizno.substr(1,1)]"/>
<prompt>
You entered
<say-as type="acronym">
<value expr="quiz_ans"/>
</say-as>
</prompt>
</block>
</form>
<form id="callee">
<var name="myarray"/>
<script>
myarray = new Array(4);
myarray[0] = 'one';
myarray[1] = 'two';
myarray[2] = 'three';
myarray[3] = 'four';
</script>
<block>
<return namelist="myarray"/>
</block>
</form>
</vxml>