Silverstripe Version: 4.7.3
Question:
How do I display a popup confirmation dialog in the CMS? Eg. similar to how the confirm delete dialog is displayed when user clicks delete button - I have added a custom ‘duplicate’ action button to GridField and detail forms and would like user to confirm the action when clicked.
I am not sure if this the recommended way to go about it but I added a custom.js script to achieve this. e.g.
(function($) {
$.entwine('ss', function($){
$('#Form_EditForm_action_importapi').entwine({
onclick: function(e) {
if(!confirm('Are you sure you want to replace all API data?')) {
e.preventDefault();
return false;
} else {
this._super(e);
}
}
});
});
})(jQuery);
If you’ve not used entwine yet:
1 Like