How do I use the <subdialog> tag?

Answers to common Plum DEV questions

Moderators: admin, support

  • Author
  • Message
Offline

support

  • Posts: 3627
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

example using <parameter> to to pass data to a subdial

PostTue Sep 02, 2003 11:25 am

When using <param> to pass a value to a subdialog, you must redeclare the variable name in the subdialog script you are using. Example:

Calling Page:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
  <var name="local_parm1" expr="'A B C D'"/>
  <var name="local_parm2" expr="'1 2 3 4'"/>
  <form>
    <subdialog src="subdialog.vxml">
      <param name="parm1" expr="local_parm1"/>
      <param name="parm2" expr="local_parm2"/>
    </subdialog>
  </form>
</vxml>


Subdialog Page:
Code: Select all
<?xml version="1.0"?>
<vxml version="2.0">
  <form id="subdialog1">
    <var name="parm1"/>
    <var name="parm2"/>
    <block>
      parm 1 is <value expr="parm1"/>.
      parm 2 is <value expr="parm2"/>
      <return/>
    </block>
  </form>
</vxml>


Notice that in the subdialog page it is we redeclare the variables parm1 and parm2. Using undeclared variables in vxml throw an error.semantic event.
Offline

support

  • Posts: 3627
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Here's how you can return an array object from a subdialog

PostWed Oct 08, 2003 5:47 pm

Here's an example of an array returned from a subdialog:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
        <form id="caller">
                <block>
                        <prompt>Going to jump.</prompt>
                </block>
                <subdialog name="subd" src="#callee">
                        <param name="myid" expr="'caller form'"/>
                </subdialog>
                <block>
                        <prompt>
                                Jumped back. The array contains:
                                <value expr="subd.myarray[0]"/>
                                <value expr="subd.myarray[1]"/>
                                <value expr="subd.myarray[2]"/>
                                <value expr="subd.myarray[3]"/>
                        </prompt>
                </block>
        </form>
        <form id="callee">
                <var name="myid"/>
                <var name="myarray"/>
                <script>
                        myarray = new Array(4);
                        myarray[0] = 'one';
                        myarray[1] = 'two';
                        myarray[2] = 'three';
                        myarray[3] = 'four';
                </script>
                <block>
                        <prompt>Jumped from <value expr="myid"/>.</prompt>
                        <return namelist="myarray"/>
                </block>
        </form>
</vxml>

The output from the above script is:
Going to jump...
Jumped from 'caller form'...
Jumped back. The array contains 'one two three four'...

Return to Plum DEV FAQs

Who is online

Users browsing this forum: No registered users and 1 guest

cron