You need to sign in to do that
Don't have an account?

pageblocktable with rows and columns and radio buttons as input values ?
HI I would like to know How to develop pageblocktable with first column as list of record names from the Master object and other 3 columns as input radio button and it should select only one radio button per record , I have to capture the result and save the column header value in the field with the record Name in another field in the child object.
Thanks for the reply i modified the code according to the exampl you mentioned. But when the page is loading value is getting selected for all the records loaded in the pageblock table . I am not able to get the selected value records in the controller with the value, Please help me to capture the list of selected records and get the value of the Proficiency.
Page:
<apex:page sidebar="false" controller="RadioinputController">
<apex:form >
<apex:pageBlock id="block3">
<apex:pageBlockTable value="{!skills}" var="sq">
<apex:column value="{!sq.Skill.Name}"/>
<apex:column headerValue="Proficiency">
<apex:selectRadio value="{!sq.answer1}">
<apex:selectOptions value="{!items}"/> </apex:selectRadio> </apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons location="Bottom">
<apex:commandButton action="{!save}" value="save"/>
</apex:pageBlockButtons>
</apex:pageBlock> </apex:form> </apex:page>
controller:
Public Class RadioinputController
{
public List<SkillsWrapper> skills {get;set;}
public List<Skill__c> selectedskillrecord {get;set;}
public RadioinputController()
{
skills = new List<SkillsWrapper>();
for(Skill__c s : [select Name From Skill__c ] )
{
skills.add(new SkillsWrapper(s));
}
}
public List<SelectOption> getItems() {
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('Basic Knowledge','Basic Knowledge'));
options.add(new SelectOption('Intermediate','Intermediate'));
options.add(new SelectOption('Advanced','Advanced'));
return options;
}
public class SkillsWrapper{
public Skill__c skill {get; set;}
public Boolean answer1 {get; set;}
public SkillsWrapper(Skill__c s){
Skill = s;
answer1 = false;
}
}
public void selectedrecords() {
selectedskillrecord = new List<Skill__c>();
for(SkillsWrapper wrapobj: skills){
if(wrapobj.answer1==true){
selectedskillrecord.add(wrapobj.skill);
}
}
}
public pagereference save()
{
system.debug('Selected Records:' +selectedskillrecord);
return Null;
}
}
Screenshot:
For getting the value in controller, you need to do something like this: