Hey guys,
Please find the code related to adding custom input check box and its related handlers.
In your component page:
<aura:component implements="flexipage:availableForAllPageTypes">
<ui:inputCheckbox aura:id="DRcheckbox" label="Dispatch required" change="{!c.onCheck}"/>
</aura:component>
Client side controller page:
({
onCheck: function(cmp, event, helper){
alert("v2");
var checkboxCmp = cmp.find("DRcheckbox");
alert(checkboxCmp.get("v.value"));
}
})
Based on the value received in the client controller page you can implement your logic.
This code is for your reference, more details are mentioned in the below video
Subscribe to my Youtube channel and get updated with salesforce tutorials - click here
Please find the code related to adding custom input check box and its related handlers.
In your component page:
<aura:component implements="flexipage:availableForAllPageTypes">
<ui:inputCheckbox aura:id="DRcheckbox" label="Dispatch required" change="{!c.onCheck}"/>
</aura:component>
Client side controller page:
({
onCheck: function(cmp, event, helper){
alert("v2");
var checkboxCmp = cmp.find("DRcheckbox");
alert(checkboxCmp.get("v.value"));
}
})
Based on the value received in the client controller page you can implement your logic.
This code is for your reference, more details are mentioned in the below video
Subscribe to my Youtube channel and get updated with salesforce tutorials - click here
Cheers!
Naveen
Twitter: https://twitter.com/naveenkn55
Linkedin: https://in.linkedin.com/in/naveenkn456
2 Comments
Hey Naveen,
ReplyDeleteHow can I make sure to keep the checkbox checked within the record I'm checking it? As of right now, this lightning component checks the checkbox field, but once I refresh the page, the checkbox is unchecked again.
Let me know if you can help me with this.
Thanks!
-Gustavo
Hi Gustavo, Here I have mentioned only the handler part, no logic to insert the record to database.
ReplyDeletewe need to implement complete functionality which stores the record. May be you can try with Lightning Data Service.