Hi
CAn you help me in correcting the script below. How to apply else if condition which check for both conditions to be true like else if(con1 && cond2)
does && is not supported?
<filled>
<script>
hours = parseInt(appTime.substr(0,2));
mins = parseInt(appTime.substr(2,4));
var ampm = "am";
if (hours > 12) {
ampm = "pm";
hours = hours - 12;
}
else if (hours == 12 and mins > 0) {
ampm = "pm";
}
formattedTime = hours + ":" + mins + " " + ampm;
</script>
<assign name="appointmentTime" expr="appTime.substr(0,2)+':'+appTime.substr(2,4)"/>
</filled>
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
Getting error using "else if" in script
-
- Posts: 53
- Joined: Sun Feb 15, 2009 11:42 pm
- Contact:
Use of javascript in IVR code
Hi,
We recommend that you read up on using javascript to use with IVR code.
As for your question, "&&" is supported, as shown in this javascript example for the <script> tag:
Hope this helps.
Regards,
Plum Support
We recommend that you read up on using javascript to use with IVR code.
As for your question, "&&" is supported, as shown in this javascript example for the <script> tag:
Code: Select all
<script type="text/javascript">
var d = new Date()
var time = d.getHours()
if (time<10)
{
document.write("<b>Good morning</b>");
}
else if (time>10 && time<16)
{
document.write("<b>Good day</b>");
}
else
{
document.write("<b>Hello World!</b>");
}
</script>
Regards,
Plum Support
Last edited by support on Mon Jan 11, 2010 2:47 pm, edited 3 times in total.
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com
-
- Posts: 53
- Joined: Sun Feb 15, 2009 11:42 pm
- Contact:
script tag giving error by validator
I'm familiar with javascript. Actually when i use <script type="text/javascript"> and try to validate the code using the plumvoice validator it says "No declaration for attribute type of element script"
And even give the same error if i use && in else if () condition.
Please help me
And even give the same error if i use && in else if () condition.
Please help me
-
- Posts: 53
- Joined: Sun Feb 15, 2009 11:42 pm
- Contact:
&& is not validated by plumvoice validator
Hi
why is the below code not validated by validator. if i replace && by || then it get validated.
<?xml version="1.0"?>
<vxml version="2.0">
<form id="new_appointment_main_frm">
<property name="timeout" value="30s"/>
<script>
var hours = parseInt(appTime.substr(0,2));
var mins = parseInt(appTime.substr(2,4));
var ampm = "am";
if (hours>12) {
ampm = "pm";
hours = hours - 12;
}
else if (hours==12 && mins>0) {
ampm = "pm";
}
var formattedTime = hours + ":" + mins + " " + ampm;
</script>
</form>
</vxml>
why is the below code not validated by validator. if i replace && by || then it get validated.
<?xml version="1.0"?>
<vxml version="2.0">
<form id="new_appointment_main_frm">
<property name="timeout" value="30s"/>
<script>
var hours = parseInt(appTime.substr(0,2));
var mins = parseInt(appTime.substr(2,4));
var ampm = "am";
if (hours>12) {
ampm = "pm";
hours = hours - 12;
}
else if (hours==12 && mins>0) {
ampm = "pm";
}
var formattedTime = hours + ":" + mins + " " + ampm;
</script>
</form>
</vxml>
">" illegal character in IVR application
Hi,
Have you tried changing the ">" character to ">" within your voicexml <script> tags of your IVR code? It is regarded as an illegal character in VXML.
Regards,
Plum Support
Have you tried changing the ">" character to ">" within your voicexml <script> tags of your IVR code? It is regarded as an illegal character in VXML.
Regards,
Plum Support
Plum Support
http://www.plumvoice.com
http://www.plumvoice.com