I have a lightning aura component and i am using one button in .cmp

<aura:attribute name="showthisButton" type="boolean" default="false"/>
 <aura:attribute name="state" type="String" />
<aura:attribute name="response" type= "String" />
<lightning:button variant="brand" label="Yes" class="slds-align_absolute-center"
                            title="Payment" onclick="{!c.sendEmailNow}"

In Controller:

sendEmailNow: function(component, event, helper){
        helper.sendEmailNow(component, event, helper);

In Helper:

sendEmailNow : function(component,event,helper) {
  var accountId = component.get("v.accountId");
  console.log('in here----'+accountId);
  var action = component.get('c.getdetails');//apex class method
  action.setParams({ 'AccountId' : accountId });
  action.setCallback(this, function(response){  
      var state = response.getState();
      var error= response.getError();
       if (state === "SUCCESS") {
      } else if (state === "INCOMPLETE") {
          alert ("Failed ");
      }else if (state === "ERROR") {
          var errors = response.getError();
          if (!errors) {
              errors = [{"message" : "Unknown Error Occured"}];
          alert ("Error occured"+errors);

1 Answer 1


You can set its disabled state directly:

sendEmailNow : function(component,event,helper) {
    event.getSource().set("v.disabled", true);

You could also have an attribute that you set, etc, but this is a pretty straightforward way to do this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .