-
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
Your 1st Step to become a Salesforce Certified Platform Developer 1 [Exam Notes]
Are you one among the many who endeavour to become a proficient Salesforce Developer? Then, this would be your first step after the completion of…
How to Avoid the Biggest Security Risks to Your Salesforce Org?
With companies leveraging platforms like Salesforce to manage their customer relationships, sales data, and marketing efforts, the security of such platforms is often overlooked as…
Best Practices of Apex In Salesforce - Here's the Complete Guide
Please follow these Salesforce Best Practices to improve our code Quality, Readability, and Reusability. Also, you can use Salesforce Best Practices to optimize our code.…
Popular Salesforce Videos
Salesforce Object Query Language (SOQL) Crash Course | The Complete Hands-on Tutorials
SOQL in Salesforce is used to retrieve data from the Salesforce database for specific information. This video covers everything you need to know as a…
Multipurpose VF Component to Add Multiple Records on a Button's Click | Salesforce Tutorials
In this video, I will create a multipurpose VF component to add Contact records in a list on the click of a button then I…
Dreamforce 2020 FAQs | Dreamforce To You | Salesforce Event
As the COVID-19 situation continues to evolve, questions around virtual Dreamforce 2020 continue to increase and that's why we've gone ahead and answered all the…