function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Himanshu Joshi 34Himanshu Joshi 34 

Alert message in Lightning

Hi there!
 I'm new to Lightening so was having a lil trouble if someone can plz help me out here,
  In my Custom Lightning Page I want to show a pop-up message saying "Do you Really want to save this Form" followed by option 'Yes' and 'No'. Clicking on which will do their respective action.
Do I need to build a component??
 
NagendraNagendra (Salesforce Developers) 
Hi Himanshu,

There are notification components documented.

You can roll your own JavaScript here as per specification
You can use one of the alerts,toasts or prompt depending on your need.

Please note all code has to be custom .

Please mark this as solved if it's resolved.

Best Regards,
Nagendra.P

 
salesforceMannsalesforceMann
Hi Himanshu, (
I havnt run the below code but it should work)

In your lightning code add:
<ui:button label="Press Me" press="{!c.handleClick}"/>
In the controller add:
/*auraMethodController.js*/
({
    handleClick : function(cmp, event) {
        confirm("Do you Really want to save this Form");
    }
})

Thanks
Mann

Please mark as answer if you feel it is :)
Ajay K DubediAjay K Dubedi
Hi Himanshu,
You can use Java script for confirmation pop and also you
can validate your data according to popup action on your java script controller.

On lightning:
<lightning:button class="slds-align_absolute-right"  variant="brand"
label="Generate PDF" onclick="{!c.clickEvent}"/>

On Java script controller:

clickEvent: function (component, event, helper) {
if (confirm('Do You Really want to save!!') == true) {
// write your code here which you want to execute on yes.
    return true;
}
else {
    return false;
}
}

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi