In cognos, radio button options appear one below the other as shown below.
As you know cognos is not having any specific property to turn the vertical radio buttons into horizontal radio button, i.e radio button one beside the other (inline). To achieve this i have used javascript.
1. Go to report studio, drag a value prompt into the report.
2. Create some static choices (Use: 1, Display: Choice 1; Use: 2, Display: Choice 2)
3. Change the 'Select UI' property to 'Radio Button Group'.
Now if you run the report and check, you can see the options of the radio button one below the other.
4. Now drag a HTML item from properties window into the page and paste the below code in that.
<script type="text/javascript">
function horizontal(choices)
{
if(choices.type == "radio")
{
choices.parentNode.parentNode.style.display="inline";
choices.parentNode.parentNode.style.whiteSpace="noWrap";
}
}
function options(node)
{
for (var i = 0; i < node.childNodes.length; i++)
{
var choices= node.childNodes[i];
horizontal(choices);
options(choices);
}
}
</script>
5. Now drag one HTML item just before the radio button prompt and place the below code in that,
<div id="radio">
6. Drag one more HTML item just after the radio button prompt and place the below code in that,
</div> <script>options(document.getElementById('radio'));</script>
7. Save the report and run it, now you can see the radio buttons one beside the other, as shown below.
Thanks....!
As you know cognos is not having any specific property to turn the vertical radio buttons into horizontal radio button, i.e radio button one beside the other (inline). To achieve this i have used javascript.
1. Go to report studio, drag a value prompt into the report.
2. Create some static choices (Use: 1, Display: Choice 1; Use: 2, Display: Choice 2)
3. Change the 'Select UI' property to 'Radio Button Group'.
Now if you run the report and check, you can see the options of the radio button one below the other.
4. Now drag a HTML item from properties window into the page and paste the below code in that.
<script type="text/javascript">
function horizontal(choices)
{
if(choices.type == "radio")
{
choices.parentNode.parentNode.style.display="inline";
choices.parentNode.parentNode.style.whiteSpace="noWrap";
}
}
function options(node)
{
for (var i = 0; i < node.childNodes.length; i++)
{
var choices= node.childNodes[i];
horizontal(choices);
options(choices);
}
}
</script>
5. Now drag one HTML item just before the radio button prompt and place the below code in that,
<div id="radio">
6. Drag one more HTML item just after the radio button prompt and place the below code in that,
</div> <script>options(document.getElementById('radio'));</script>
7. Save the report and run it, now you can see the radio buttons one beside the other, as shown below.
Thanks....!