You need to sign in to do that
Don't have an account?
default value of radio button
Hi All,
I have to set default value of radio button based on condtion which comes from controller. sample code is below:
Visual force page:
<apex:pageBlockSection >
<input type="radio" name="triptype" id="triptype" value='{!selectedValue1}' checeked = '{!selectedValue1 != null}'
onclick="tripSelection(this.value)" />test1<br/>
<input type="radio" name="triptype" id="triptype" value='{!selectedValue2}' checeked = '{!selectedValue2 != null}'
onclick="tripSelection(this.value)" />test2<br/>
</apex:pageBlockSection >
Apex Code:
public class testClass{
public testClass(){
if(cond){ selectedValue1 = 'abc'}
else{ selectedValue1= 'xyz'}
} }
Please help me to resolve this requirement.
Thanks,
Sandy
Hi,
You can use the <apex:selectRadio> instead of <input type =”radio”>
You can try the below code snippet
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.