• Shane Gilbert
  • NEWBIE
  • 0 Points
  • Member since 2017
  • HyperWave Consulting

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hello All,
Has anyone else ran into this issue in the Trailhead "Build the AccountList Component" Project?

The code is copied from the project but I cannot get the dialog box to appear when the delete buttons are clicked.

AccountList.cmp form:
<form class="account-form" onsubmit="{!c.deleteAccount}">
  <input type="hidden" value="{!account.Name}" class="account-name" />
  <!--
    Use a Lightning Base Component
    To display an icon next to the label
   -->
  <lightning:button label="Delete"
                    iconName="utility:delete"
                    iconPosition="left"
                    variant="destructive"
                    />
</form>
AccountListController.js 
 
({
  doInit: function(component, event, helper) {      
    // Fetch the account list from the Apex controller   
    helper.getAccountList(component);
  },
  deleteAccount: function(component, event, helper) {
    // Prevent the form from getting submitted
    event.preventDefault();

    // Get the value from the field that's in the form
    var accountName = event.target.getElementsByClassName('account-name')[0].value;
    confirm('Delete the ' + accountName + ' account? (don’t worry, this won’t actually work!)');
  }
})
Thanks,
Shane



 
Hello All,
Has anyone else ran into this issue in the Trailhead "Build the AccountList Component" Project?

The code is copied from the project but I cannot get the dialog box to appear when the delete buttons are clicked.

AccountList.cmp form:
<form class="account-form" onsubmit="{!c.deleteAccount}">
  <input type="hidden" value="{!account.Name}" class="account-name" />
  <!--
    Use a Lightning Base Component
    To display an icon next to the label
   -->
  <lightning:button label="Delete"
                    iconName="utility:delete"
                    iconPosition="left"
                    variant="destructive"
                    />
</form>
AccountListController.js 
 
({
  doInit: function(component, event, helper) {      
    // Fetch the account list from the Apex controller   
    helper.getAccountList(component);
  },
  deleteAccount: function(component, event, helper) {
    // Prevent the form from getting submitted
    event.preventDefault();

    // Get the value from the field that's in the form
    var accountName = event.target.getElementsByClassName('account-name')[0].value;
    confirm('Delete the ' + accountName + ' account? (don’t worry, this won’t actually work!)');
  }
})
Thanks,
Shane