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
AkshiiiiiAkshiiiii 

How do i get the selected value in a checkbox

Hi,
How can I get the selected value in a checkbox(in js controller) and send it to a method in apex class?

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Akshiiii,

>> https://www.infallibletechie.com/2018/08/how-to-handle-selectedrows-in.html

The above link has an implementation of handing the selected records to apex controller class.
you have two option:

Send only the accRecmId to your Server method like this:
JS Controller:

var selectedList = component.get('v.pricingRecommendationListDetailsData');

    var ids=new Array();
    for (var i= 0 ; i < selectedList.length ; i++){
        ids.push(selectedList[i].accRecmId);
    }

    var idListJSON=JSON.stringify(ids);

    var action = component.get("c.callServier");
    action.setParams({
            "accRecmId":idListJSON
    });
Apex Controller:

public static void callServier(String accRecmId) {
    Type idArrType = Type.forName('List<string>');
    List<string> wrapperList = (List<string>) JSON.deserialize(accRecmId, idArrType);
}
Pass all attribute to your apex controller and inside your apex controller get the accRecmId.

Let me know if it helps you and close your query by marking it as the best answer so that it can help others in the future.  

Thanks.