-
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

Salesforce Spring ’20 – The Top Features
The Spring ’20 release of Salesforce is coming in mid-February 2020. Here are some of the new features that will make life easier for users,…

Salesforce Awesome Admin Tips for Productivity | Salesforce Admin
It’s no secret that Salesforce continually ranks as one of the highest recommended cloud-based software management platforms. It has proven to be an incredibly robust…

What is Salesforce for Nonprofits in 2024?
Salesforce for nonprofits is a game-changer in the world of philanthropy and social impact. This innovative platform harnesses the power of technology to empower nonprofit…
Popular Salesforce Videos
5 Steps to Faster Case Resolution | Salesforce Support
When it comes to filling out a Salesforce case from, the description field and attached files are key to fast routing and resolution. Here are…
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…
Sales Process in Salesforce | Opportunity Object Explained
Opportunities in Salesforce Sales Cloud allow sales teams to organize and track their sales pipeline effectively. Each opportunity represents a potential deal, and it can…