-
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

All You Need to Know About Workbench in Salesforce
Salesforce Workbench is a powerful tool for developers and administrators who work with Salesforce on a regular basis. It is an online application that allows…

Running Case Assignment Rules From Salesforce Apex
Hi All, We all know that the Case Assignment Rule decides how cases are assigned to users or put into queues. We can create multiple…

Steps to Hire a Salesforce Support and Maintenance Consultant: A Comprehensive Guide
Salesforce, a powerful CRM platform, requires ongoing support and maintenance to ensure optimal performance, security, and alignment with your business goals. Hiring a skilled Salesforce…
Popular Salesforce Videos
Salesforce Einstein – CRM Stepping Into The World Of AI
We belong to a hyper-connected world these days where each and every step we take is an onslaught of data. So for this world what…
Salesforce Careers: Drive Success Through the Lens of the Customer
Salesforce employs over half of the Technical Architects across the globe and is shaping the future! Visit careers at Salesforce to apply for the Professional…
Why Users Cannot be Deleted from Salesforce | How to Delete User from Salesforce?
Why users cannot be deleted from Salesforce and how to delete users from Salesforce? Watch this video and learn all about it. Do let us…