Page 1 of 1

Javascript returns string but not boolean!

Posted: Fri Aug 28, 2009 10:25 am
by soso
Hi,

I try to use this code:

Code: Select all

<data name="auth" src="Get.aspx" namelist="ID phone" maxage="0"/>
                    <script>
bip = auth.documentElement.getElementsByTagName("bip").item(0).firstChild.data;
</script>

...

<field name="msg" cond="bip==false">
...
</field>
The value of "bip" element is true or false only.

But, when I execute the code, the value is always set to false, because the line script return a string, and not boolean value.

How do I use the script to return a boolean value?

Thanks by advance.

IVR code example for returning boolean value

Posted: Mon Aug 31, 2009 1:33 pm
by support
Hi,

We're not sure what's happening in your Get.aspx script, but we've provided an IVR code example of how you can return a boolean value (0 or 1) using the IVR tag, <data>:

data.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
$random1 = 0;
$random2 = 1;
?>

<booleans>
<boolean><?php echo($random1);?></boolean>
<boolean><?php echo($random2);?></boolean>
</booleans>
datavalueboolean.php:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.1">
  <form>
    <data name="thedata" src="data.php"/>

<script>
bip = thedata.documentElement.childNodes.item(0).firstChild.toString();
</script> 

      <block>
        The value is <value expr=
        "thedata.documentElement.childNodes.item(0).firstChild.toString()"/>.
      </block>
  </form>
</vxml>
Hope this IVR code helps.

Regards,
Plum Support