Page 1 of 1

Multiple Forms in Single vxml - Field passing

Posted: Thu Mar 26, 2009 2:18 pm
by amitkhosla
hi,

Can you please help me with passing multiple field values to a next form element defined in the same vxml where i'm using goto to take the control to the next form?

something like this
---------------------
<vxml>
<form name='"form1">
<field name="name"/>
<field name="age"/>

fields have been assigned some values...
i do <goto next="#form2"/>
</form>
<form name="form2">
i want to use the field values assined to name and age in form 1 here in this form2
</form>
</vxml>

IVR code to pass multiple field values to next form element

Posted: Thu Mar 26, 2009 3:45 pm
by support
Hi,

Here's some IVR code that should help you accomplish this:

variables.vxml

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">

<var name="var1" expr=" "/>
<var name="var2" expr=" "/>
<var name="var3" expr=" "/>

<form id="form1">
<grammar type="application/srgs+xml" root="ROOT" mode="voice">
     <rule id="ROOT">
          <one-of>
               <item>
                    Dog
                         <tag>
                              name="Lassie";age="5";color="brown"
                         </tag>
               </item>
               <item>
                    Cat
                         <tag>
                              name="Garfield";age="7";color="orange"
                         </tag>
               </item>
          </one-of>
     </rule>
</grammar>

<initial>
     <prompt>
          Say either dog or cat.
     </prompt>
</initial>

<field name="name"/>
<field name="age"/>
<field name="color"/>

<filled>
<assign name="var1" expr="name"/>
<assign name="var2" expr="age"/>
<assign name="var3" expr="color"/>
<goto next="#form2"/>
</filled>
</form>

<form id="form2">
    <block>
      <prompt>
               The pet's name is <value expr="var1"/>.
               The pet is <value expr="var2"/> years old.
               The pet's fur color is <value expr="var3"/>.
      </prompt>
    </block>
</form>

</vxml>
By creating <var>s at the vxml level and <assign>ing them with the <value>s of your fields, you will be able to pass them onto your next form.

Hope this helps.

Regards,
Plum Support