function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
hacksawblade16hacksawblade16 

Make first radio button checked by default

var orgRadioData= j$('input[name=pradios]:radio:checked').val();

<input type="radio"  value="{!ppls.id}"  name="pradios"/>

 

How can i make the first radio button of the family checked by default

SurekaSureka

Hi,

 

If you make use of  <apex:inputCheckbox>, use the attribute - selected = true. This will select the corresponding checkbox by default.

 

In html, use checked="yes"

 

Thanks

 

hacksawblade16hacksawblade16

By using the checked attribute .The last radio button in the family is getting checked.I want the first radio button to be checked by default.

 

Thank you

SurekaSureka

Hi,

 

"checked" attribute will make the corresponding checkbox checked.

 

Otherwise, Use a boolean variable from the controller and set the value to true or false. Use this boolean variable in "Checked.

 

Thanks

hacksawblade16hacksawblade16
<Apex:column >
<input type="radio" value="{!houses.id}" name="hradios" checked="{!houses.selction}" />
</apex:column>
Even by doing this the last radio button of the column is getting selected.I want the first radio button in the column to be selcted.

Thank you
SurekaSureka

Why dont you try <apex:inputCheckbox>?

hacksawblade16hacksawblade16
If i use input check box then Will it behave like radio button??such that only one must be selected.
hacksawblade16hacksawblade16
Thank you Mam that was useful,but I have a list of records of multiple objects.I don think i can use select option to add objects
Kunal ChowdhuryKunal Chowdhury
was this resolved @hacksawblade16 ?
I am using the same checked attribute but only the last row is geting selected everytime!
<input type="radio" checked="{!sqw.isChecked}" name="<strong>selectRadio</strong>" >
even though in the Inspect Element I can see that only the row I want has checked="checked"..
Why would this happen?