Thursday, February 18, 2010

JavaScript to Deselect Value Prompt Box Selections

Step 1: Name the Value prompt as Owner.

Step 2: Drag a HTML Item into the report just below the Value Prompt and insert the below script into the same:


<script type="text/javascript">
function Refresh()
{
var fW = (typeof getFormWarpRequest == "function" ?getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)
{ fW = ( formWarpRequest_THIS_ ?formWarpRequest_THIS_ : formWarpRequest_NS_ );
}
var obj = fW._oLstChoicesOwner;
obj.selectedIndex = -1;
}
</script>
<input type='button' onclick='Refresh()' value='Refresh'>


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.

1 comment:

Anonymous said...

Hi Zephyr,

I would like to have the first value as default value in checkbox value prompt. Can you please help me with the Java script for this.

Thanks,
Krithi