COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: knip on 13 Mar 2018 09:10:28 PM

Title: Javascript for radiobutton
Post by: knip on 13 Mar 2018 09:10:28 PM
Can someone help me with a javascript which automatically selects the first value of the radio button prompt?
Title: Re: Javascript for radiobutton
Post by: Pratap Reddy on 14 Mar 2018 02:02:33 AM
Hi,

You can use Default Selections in the Properties Pane of Radio Button Prompt.

Eg: 2010,2011,2012,2013 are there in Radio Button Prompt.

You can give 2010 in the Default Selections

Regards,
Pratap
Title: Re: Javascript for radiobutton
Post by: Pratap Reddy on 14 Mar 2018 02:22:11 AM
Quote from: knip on 13 Mar 2018 09:10:28 PM
Can someone help me with a javascript which automatically selects the first value of the radio button prompt?

<form><div>
<input type="radio" name="Parameter1" 
name="Year" value="2010" checked>
</div>
</form>


Regards,
Pratap
Title: Re: Javascript for radiobutton
Post by: BigChris on 14 Mar 2018 04:09:43 AM
But what would you need in a variable list of values? Say for example you were going to limit the radio button prompt to be the last ten years...how would you select the first value regardless of what year it was?
Title: Re: Javascript for radiobutton
Post by: Pratap Reddy on 14 Mar 2018 05:23:47 AM
Hi,

This have to work...

<script type = "text/javascript">
var fW =(typeof getFormWarpRequest == "function"? getFormWarpRequest() : document.forms["formWarpReguest"]);
if (fW)
{
if (fW._oLstChoicesMyList.length >= 1)
{
fW._oLstChoicesMyList.selectedIndex = 0;
}
}
</script>

Name the Miscellaneous to MyList.

Regards,
Pratap