If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

javascript to hide element

Started by avuong6, 01 Nov 2017 03:46:12 PM

Previous topic - Next topic

avuong6

i have a prompt page where i would like to use the selection of a value prompt to hide or unhide another value prompt further down on page.
how to do with javascript and prompt api in 10.2.2?

i have this code:
======================================================
<script language="javascript">
function ShowHide2(){

var el = document.getElementById("OtherOps7");
if ( el.style.display != 'none' ) {
el.style.display = 'none';
}
else {
el.style.display = '';
                     }
}

function startHidden2(){
var el = document.getElementById("OtherOps7");
if ( el.style.display != 'none' ) {
el.style.display = 'none';
}
}

window.onload=startHidden2();

</script>
======================================================

it works when i call the function from a javascript link. however i want to call it based on the value of the prompt. when the dropdown has 1, it should hide, and when dropdown has 2, it should show.






Kiran Kandavalli

#1
Hope my understanding is correct,

You want to hide ValuePrompt2 based on ValuePrompt1 right?, if yes, we can use a Render Variable to hide the ValuePrompt2.

Steps:

1) Create ValuePrompt1 and enter Static Choices as 1 & 2
2) Select the Default Value as "1"
3) in ValuePormp1 change AutoSubmit Property to "Yes"
4) Create Value Prompt2 and in Properties select the Cascading source as "Parameter of ValuePrompt1"
5) Create a Variable
     Case
     when ParamValue(?Parameter of ValuePrompt1?)=1 then ('S')
     else ('DS')
     End
6) in Value Prompt2 Properties - Render Variable --> Select this Variable and select the option 'S'
7) Run the Report.

Thanks!
Kiran