COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: venkiatmaruthi on 16 Mar 2011 08:15:31 AM

Title: Javascript: select first value in Radio button group
Post by: venkiatmaruthi on 16 Mar 2011 08:15:31 AM
How to select first value in a radio button group using Javascript.

say I have a radio button group for Country.

Canada
Englad
SouthAfrica
India
Pakistan
Japan
China

I want every time the Englad should select.


<script>
var radbut=document.getFormWarpRequest()._oLstChoicesLocation;
radbut.options[1].checked=true;
</script>
Title: Re: Javascript: select first value in Radio button group
Post by: melee on 16 Mar 2011 10:02:15 AM
<script>
var radbut=document.getFormWarpRequest()._oLstChoicesLocation;
radbut.options[0].checked=true;
</script>


I think that's what you're looking for?
Title: Re: Javascript: select first value in Radio button group
Post by: venkiatmaruthi on 16 Mar 2011 10:05:29 AM
Melee,

I am looking to select the second option not the first option.

That's why I mentioned

radbut.options[1].checked=true;

By the way, both options[0] or options[1] is not working at all.

Thanks.
Title: Re: Javascript: select first value in Radio button group
Post by: melee on 16 Mar 2011 10:08:50 AM
Sorry! I misunderstood. Have you tried doing this with Default Selections in the prompt? I'd try there first.

Try this:

http://nicbertino.com/?p=63