Friday, 29 November 2013

Drop down values as default value in cognos value prompt

We can select first or second or nth values form the drop down as default selection .

step1:
create a html item with the following script and placed it left of the prompt.

<span id="Period">

Period is my prompt name:
In prompt properties miscellaneous you can get option to set name.

step2:
create another html using below script.and placed it on right of the prompt.

</span>

Step3:

create one more html item with below script and placed it right to the above html.

<script type="text/javascript">
var theSpan = document.getElementById("promptname");
var theSelect = theSpan.getElementsByTagName("select");
theSelect[0].options[2].selected=true;
</script>

This example is selecting first value  as default .
You can change values based on your requirement in option( theSelect[0].options[2].selected=true;)


1 comment:

  1. How can you set the Options[ ] number dynamically?

    ReplyDelete