-
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

Here's How You Can Ease Operations for Your Non-Profit Organization: With a Salesforce Customer Portal
Salesforce's powerful customer portals give you the tools to keep your organization running efficiently and provide your members, donors, and customers with more self-service and…

How Can You Get High Output With Salesforce DX and Enjoy Lots of Benefits
What is it that has driven app developers crazy after Salesforce DX? There must be some important reasons and features in it, which makes it…

Algoworks Is Glad To Announce Partnership With WebMerge
A. Introduction To WebMerge Webmerge is an online platform that gives the ability to collect data easily, allowing to populate a document, and sending it…
Popular Salesforce Videos
How to Create a Salesforce Object Calendar
In this video, we show you how to create a calendar view for any object in Salesforce. This is a feature that can easily help…
Do you need to learn Salesforce Admin & App Builder if you want to become Salesforce developer ?
5 reasons why you need to learn the Salesforce Admin and App Builder even if you want to become or you are a Salesforce Developer.…
Build an App Home Lightning Page | Salesforce Lightning Tutorial
Learning Objectives After completing this unit, you’ll be able to: Add components to a Lightning page Configure the properties of a Lightning page and a…