-
Confirm box on submit for Salesforce Lightning Button does not appear
Confirm box on submit for Salesforce lightning button does not appear:
I am going through "Build a Lightning App with the Lightning Design System" project in Trailhead.
In the AccountList.cmp component there is below code that creates "Delete" button in each row in the table created in that project.
As exercise states - click on any Delete botton should dsplay dialog box. It does Not happen.
So far I was not able to find out why, please help. Many thanks
<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>------------------ in the javascript controller AccountListControlle.js there is following code:
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!)'); --- THIS LINE DOES NOT WORK, DIALOG BOX DOES NOT SHOW UP.
}
Log In to reply.
Popular Salesforce Blogs
![](https://images.forcetalks.com/wp-content/uploads/2024/09/17072206/sa_1726557441ForcetalkPublishingFeatureImageV_2.jpg)
How Salesforce CPQ Enhances Your Sales Team’s Efficiency
In today's fast-paced business environment, efficiency and accuracy are paramount for sales success. Configure, Price, Quote (CPQ) software has emerged as a vital tool to…
![](https://images.forcetalks.com/wp-content/uploads/2019/07/15080022/FT-Banners-5.jpg)
Integrate Salesforce with MuleSoft
In this blog we are focusing on Salesforce integration with MuleSoft. Firstly, we will need a Salesforce developer account by clicking on the following link:…
![](https://images.forcetalks.com/wp-content/uploads/2023/12/29060641/sa_1703829986mailcommunicationconnectionmessagemailingcontactsphonegloballettersconceptmin-1024x683.jpg)
Benefits of MailChimp to Pardot Migration
Migrating from Mailchimp to Salesforce Account Engagement concerning marketing and customer relationship management offers many benefits for businesses. Salesforce Account Engagement, which includes Pardot as…
Popular Salesforce Videos
Sandbox Design Strategies for Enterprise Implementations
It is inevitable to avoid Sandboxes in most enterprise implementations. As different teams work on different processes like testing, development, pre-release, and final rollout, it…
Future Methods | Asynchronous Apex | Salesforce Tutorial
Asynchronous Apex 1. Future Methods 2. Making callout using future method 3.Avoiding Mixed Dml using Future Method 4. Why sObjects and objects cannot pass as…
Schedule Apex Jobs with Lighting Web Components | Developer Quick Takes
Lightning Web Components gives you the ability to give your users a great user experience when interacting with Salesforce. In this example, we will take…