VoiceXML 2.1 Development Guide Home  |  Frameset Home


<param>  element


The param element is used when submitting data to a subdialog or an object. Note that any params sent to an external subdialog file must have the param set as a form-level variable within the target page; i.e. :

Main.vxml

<subdialog name=”MySubD” src=”SubDFile.vxml”>
<param name=”Var1” expr=”’porkchops’”/>


SubDFile.vxml
..
<form>
<var name=”Var1” expr=””/>
..



usage

<param expr="CDATA" index="CDATA" name="NMTOKEN" type="CDATA" value="CDATA">


attributes

expr Data Type: CDATA Default: Optional
The expr attribute equates to an ECMAScript  value that defines the value for the parameter. Of note is the fact that expr and value are mutually exclusive attributes.
index Data Type: CDATA Default: Optional
The index attribute, used when invoking an object, is used by the developer to specify a particular index reference in an array of parameters.
name Data Type: NMTOKEN Default: Optional
The name attribute specifies the name of the parameter to be passed to the destination URI.
type Data Type: CDATA Default: Optional
The type attribute is only relevant when used in conjunction with the object element, and specifies the MIME type of the destination object.
value Data Type: CDATA Default: Optional
The value attribute specifies the literal string value of the parameter getting passed to the destination URI.



shadow variables

none


parents

<param>   <subdialog>


children

<param>


code samples

<Param name - expr> sample
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.0">

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1">
  <subdialog name="SubD_1" src="MySubD.vxml">
    <param name="confirm_prompt"
      expr="'should vin diesel think about another profession?'"/>

 
    <filled>
      <prompt> yeah, you are probably right. </prompt>
    </filled>

  </subdialog>

</form>
</vxml>


<MySubD.vxml>
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>



<form id="F1">

  <var name="confirm_prompt"/>
  <var name="response"/>

  <field name="field_confirm" type="boolean">
    <prompt>
      <value expr="confirm_prompt"/>
    </prompt>

    <filled>
      <if cond="field_confirm == true">
        <assign name="response" expr="'yes'"/>
      <else/>
        <assign name="response" expr="'no'"/>
      </if>
      <return namelist="response"/>
    </filled>

  </field>
</form>

</vxml>
 



additional links

W3C 2.0 Specification


  ANNOTATIONS: EXISTING POSTS
Lampei
9/24/2004 9:52 PM (EDT)
Shouldn't "parent" be subdialog, not param?
MattHenry
9/27/2004 12:55 PM (EDT)
Eeep! You got me on this one; I had the element listed as a valid parent, but not actually enabled for the Motorola docset. This is fixed in our internal build of the docs, and should be reflected on the live site within the next 24 hours.

Thanks for the catch!

~Matt
vinayagan
12/15/2006 10:45 AM (EST)
Hi,

  I belive param is a child of object also..Our document has specified only subdialog and param

Thanks
Nayagan
mikethompson
12/15/2006 2:05 PM (EST)
Hi Nayagan,

You are correct, <object> is indeed a parent of <param>.  Unfortunately, Voxeo does not support the use of the <object> element, so I presume that is why it was left out of the documentation as a reference.

Best,
Mike Thompson
Voxeo Corporation
mtatum111
9/29/2008 10:16 AM (EDT)
I am a little confused with the attributes of value and expr.  I was thinking that expr was used to hold the name.  However, it looks like it actually contains the value of what is being sent.

can you give an example of expr and value so that I can hopefully understand the differences.

Thanks
VoxeoDustin
9/29/2008 10:20 AM (EDT)
Hey Melissa,

The name is actually held in the 'name' attribute. value and expr are similar, in that they pass the actual value of the parameter, however, 'value' is for a literal string value, and expr is for an ECMAScript expression:

Value:
<param name="my_param" value="foobar"/>

Expr:
<var name="var_1" expr="foo"/>
<var name="var_2" expr="bar"/>

<param name="my_param" expr="var_1 + var_2"/>

Cheers,
Dustin
mtatum111
9/29/2008 10:30 AM (EDT)
Dustin, thanks for the clarification.  In that case, for the above example that is given
<form id="F1">
  <subdialog name="SubD_1" src="MySubD.vxml">
    <param name="confirm_prompt"
      expr="'should vin diesel think about another profession?'"/>
 
    <filled>
      <prompt> yeah, you are probably right. </prompt>
    </filled>

  </subdialog>

</form>

shouldn't param be the following since it is a litteral.
<param name="confirm_prompt"
      value="'should vin diesel think about another profession?'"/>

VoxeoDustin
9/29/2008 10:33 AM (EDT)
Hey Melissa,

Since the string is enclosed in single quotes, this is in fact a valid ECMAScript expression. However, it would make more sense to use value here since it is a literal string.

Thanks,
Dustin
mtatum111
9/29/2008 10:36 AM (EDT)
Dustin, thanks as always for the explanation.
mtatum111
10/14/2008 9:51 AM (EDT)
what happens if you have the following

<param name="temp1" value="24"

then in your subdialog you have
<var name="temp1" expr="45" />

I am assuming that temp1 will now have a value of 45 in the subdialog as long as you are in there(since it has been "re-assigned" this new value)?  Of course, after returning from the subdialog, this variable is non-existent.
Is that the case?
voxeojeremyr
10/14/2008 10:50 AM (EDT)
Hi Melissa,

You are absolutely correct.  Of course if you had previously defined the variable temp1 before the subdialog as say '15' it would revert to that value.

Regards,
Jeremy Richmond
Voxeo Support
avlim
1/20/2009 9:51 AM (EST)
Hi all
I have foloowing question: Is the description of param like
<param name="validity" type="string" expr="43200"/>
match to
<param name="validity" type="string" expr="'43200'"/>?

Will be result of expression implicity converted to string type?
voxeojeremyr
1/20/2009 10:30 AM (EST)
Hi Andrey,

The 'type' attribute is only valid if you are using the <param> element in conjunction with the <object> element.  The <object> element is an optional tag that Voxeo does not support.  So the use of 'type' would not be warranted.

However if you wanted to send a string the syntax would look like this:
<param name="validity" expr="'43200'"/>

This would pass the variable 'validity' as a string value of '43200'.

Please let us know if you have any questions.

Thanks,
Jeremy Richmond
Voxeo Support

login



© 2013 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site