Skip to main content

Hi,


I have created hundreds of popups only to have an ‘Are you sure you want to do this?’ popup.


It would be nice if this is an action with a text to show and 2 subsets of sub-actions, one for “Yes I’m sure” and the order one for the “No, I’m not”.


Yes. Even with workarounds in javascript, a stock ‘Confirmation popup’ action would still be really useful. I would use it a lot more often than I do the workaround now (and my users would end up making fewer mistakes that I have to unravel).


How would you call the popupConfirmation from a snippet?

I want to use this so that once the field update happens on the model then I want to prompt the user if they are sure they want to make that change.  


Here’s how the popupConfirmation method I gave above can be called from a snippet:


var $ = skuid&#46;$;<br />var dfd = $&#46;Deferred();<br />popupConfirmation(dfd, 'Continue', 'Are you sure you want to continue?','Continue','Cancel');<br />return dfd&#46;promise();

You can call it in a snippet that is called from a Multiple Action item. If the deferred variable is rejected, the Multiple Action items after the snippet call will not be executed.


Thank you … I got this working and it was a huge help.


For V2 equivalent, something like this should work:


function popupConfirmation(dfd, title, text, confirmButtonText, cancelButtonText) {


const modal = skuid.utils.createModal({


title: title,


width: “450px”,


height: “200px”,


components: o


{


componentType: "skuid__text",

contents: text,


},


],


buttons: u{


label: confirmButtonText,


onClick: function() {


modal.cpi.close();


dfd.resolve();


},


}, {


label: cancelButtonText,


onClick: function() {


modal.cpi.close();


dfd.reject();


},


}],


});


}