Step 1: Drag 2 Date Prompts into the prompt page
Step 2: Name the Date Prompts as FromDate and ToDate
Step 3: Drag an HTML Item below the prompts and include the below script:
<script type="text/javascript">
function validateDate()
{
var fW = (typeof getFormWarpRequest == "function" ?getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)
{ fW = ( formWarpRequest_THIS_ ?formWarpRequest_THIS_ : formWarpRequest_NS_ );
}
var FromDate = fW.txtDateFromDate.value;
var ToDate = fW.txtDateToDate.value;
if(FromDate > ToDate)
{alert('From Date is greater than To Date');}
else
{promptAction('finish');}
}
</script>
Step 4: Drag another HTML Item to create the prompt button. The onclick event of the button will trigger the date validation function.
<input type=button onclick='validateDate()' value='Finish'>
Step 5: Drag a Prompt Button - Finish to enable the submission of the prompt page and hide the button by seting the height and width to 0px.
Note: This technique uses JavaScript against underlying report objects in a IBM Cognos 8 BI report. For this reason, there is no guarantee that reports created using this technique will migrate or upgrade successfully to future versions without requiring modifications. Any such modifications are the responsibility of the report designer.