I have created one lightning component and it is showing Questions(Master object) and Question Options(Details object). Question options are binded with Radio Button group in lightning component. I used wrapper class to achieve this. I am not able to get the selected radio button value. I need to the selected radio button value and insert them into a custom object called response

public class QuestionRadioWrapper {
    public Post_Chat_Question__c q {get; set;}
    // @AuraEnabled
    //public static String selectedRadio {get; set;}
    public  String getselectedRadio() {
        return selectedRadio;

    public void setselectedRadio(String sltdRad) {
        selectedRadio = sltdRad;

    public QuestionRadioWrapper(Post_Chat_Question__c q) 
        this.q = q;  

Here is my lightning component code:-

 <lightning:radioGroup name="{!wrapRad.q.Name}"

How do i get the selected radio button value dynamically and insert it into the Response object

  • Note that @AuraEnabled is commented out above public String getselectedRadio(). Try putting that back in. – Brian Miller Apr 8 '19 at 13:09

Refer documentation: Radio Group

<aura:attribute name="value" type="String" default="option1"/>
        label="Radio Button Group"
        options="{! v.options }"
        value="{! v.value }"
        onchange="{! c.handleChange }"
        required="true" />

You can check which values are selected by using cmp.find("mygroup").get("v.value"). To retrieve the values when the selection is changed, use the onchange event handler and call event.getParam("value").

    handleChange: function (cmp, event) {
        var changeValue = event.getParam("value");
|improve this answer|||||
  • Yes I did go through it but how are we supposed to Map the selected radio button value with the correct parent record while inserting – Amit Rajput Apr 8 '19 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.