You need to sign in to do that
Don't have an account?
jay209
Uncaught Action failed: event.getSource is not a function not working for Lightning button
I have an `aura:Iterate` in iterate i have a close icon onclick of that i will get an modal popup and i will give values and click on **submit** then modal will close and i want to make that button disable. below i am posting my code.
**Controller:**
rejcomment : function(component, event, helper)
{
component.set("v.isRejectOpen", false);
component.find("v.IDFReject", "icn");
var mydid = component.get("v.forselectedidf");
alert('Before assigned');
var btn = event.getSource();
btn.set("v.disabled",true);
alert('Assigned');
},
**Component:**
<lightning:button iconName="utility:close" aura:id="{!idf.Base_Invention_Disclosure__c}" variant="bare" disabled="false" class="{!v.IDFReject}" onclick="{!c.openrejModel}" value="{!idf.Base_Invention_Disclosure__c}" />
i have tried like this and i am getting following Error.[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/rPsQR.png
Correct me where i am doing wrong.
Thanks
**Controller:**
rejcomment : function(component, event, helper)
{
component.set("v.isRejectOpen", false);
component.find("v.IDFReject", "icn");
var mydid = component.get("v.forselectedidf");
alert('Before assigned');
var btn = event.getSource();
btn.set("v.disabled",true);
alert('Assigned');
},
**Component:**
<lightning:button iconName="utility:close" aura:id="{!idf.Base_Invention_Disclosure__c}" variant="bare" disabled="false" class="{!v.IDFReject}" onclick="{!c.openrejModel}" value="{!idf.Base_Invention_Disclosure__c}" />
i have tried like this and i am getting following Error.[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/rPsQR.png
Correct me where i am doing wrong.
Thanks
Refer below link for similar discussion.
https://salesforce.stackexchange.com/questions/206775/how-to-disable-lightning-button-after-click
Please mark it as Solved if my reply was helpful. It will make it available for other as the proper solution.
Thanks and Regards
Sandhya
This will work for single button.here i am trying to do in aura:Iterate
Try using
event.currentTarget
or
event.target
or
event.srcElement
whichever works for you. I guess all three should work. Start with event.srcElement.
Let me know if it helps