Tuesday, May 14, 2013

cognos javascript multi select checkbox default checked all checkbox


Cognos Javascript prompt functions does not work with checkbox prompts. So you have to do using following functions. It is working for me.


<script type="text/javascript">
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms);

if ( !fW || fW == undefined) {
fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );
}

if (fW) {
var list = fW._oLstChoicesChkbox1;
if(list.length == null) {             // if there is only one option
list.checked = "checked";
list.onclick();
}
else {
for( i=0; i<list.length;i++) {
list[i].checked = "checked";
list[i].onclick();
}
}
}
</script>

1 comment:

  1. So helpful, just have to remember to name your checkbox "Chkbox1", and add the div/id

    ReplyDelete