Skip to main content
Hi all,

 I need to check and uncheck the checkbox in salesforce lighting. anyone, please guide me. below code doesn't work properly.

Controller:

 confirm :function(component, event, helper) {

        if(event.target.title =='false'){

           component.find("PaymentCleared").set('v.value',false);  

            component.set('v.simpleRecord.Payment_Cleared__c',false);

        }

        else{

             component.find("PaymentCleared").set('v.value',true); 

             component.set('v.simpleRecord.Payment_Cleared__c',true);

        }
2 réponses
  1. 26 août 2018, 00:19
    Hey Gnana Sundar, 

    <button  class="slds-button slds-button--neutral" title="false" data-buttonval="false" onclick="{!c.confirm}" >Cancel</button>

                        <button  class="slds-button slds-button--brand" title="true" data-buttonval="true" onclick="{!c.confirm}" >confirm</button>

    controller use below code: 

    console.log(event.target.dataset.buttonval); //gives true/false based on selection. 

    Regards,

    Naveen Ila