We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Multiple Forms in Single vxml - Field passing

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
amitkhosla
Posts: 53
Joined: Sun Feb 15, 2009 11:42 pm
Contact:

Multiple Forms in Single vxml - Field passing

Post 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>

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR code to pass multiple field values to next form element

Post 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

Post Reply