The following script enables to compare 2 date prompts on a dashbaord to tell the user to select a prior Date less than the current Date warning message..
Insert a text box into a dashboard "Contains HTML"
Then paste the following code into the text box
<head>
<script type="text/javascript">
var curr = '@{currentdate}{2013-01-31}';
var prev= '@{previousdate}{2012-12-31}';
dt1=parseInt(curr.substring(8,10),10);
mon1=parseInt(curr.substring(5,7),10);
yr1=parseInt(curr.substring(0,4),10);
dt2=parseInt(prev.substring(8,10),10);
mon2=parseInt(prev.substring(5,7),10);
yr2=parseInt(prev.substring(0,4),10);
date1=new Date(yr1, mon1, dt1);
date2=new Date(yr2, mon2, dt2);
if (date1<=date2)
alert('Please enter the Prior Date value as less than Current Date');
//
</script>
</head>
Insert a text box into a dashboard "Contains HTML"
Then paste the following code into the text box
<head>
<script type="text/javascript">
var curr = '@{currentdate}{2013-01-31}';
var prev= '@{previousdate}{2012-12-31}';
dt1=parseInt(curr.substring(8,10),10);
mon1=parseInt(curr.substring(5,7),10);
yr1=parseInt(curr.substring(0,4),10);
dt2=parseInt(prev.substring(8,10),10);
mon2=parseInt(prev.substring(5,7),10);
yr2=parseInt(prev.substring(0,4),10);
date1=new Date(yr1, mon1, dt1);
date2=new Date(yr2, mon2, dt2);
if (date1<=date2)
alert('Please enter the Prior Date value as less than Current Date');
//
</script>
</head>
Note: only a member of this blog may post a comment.