Is there a recommendation for adding more controls to the Editor's Delete dialog box?

Is there a recommendation for adding more controls to the Editor's Delete dialog box?

MHPjr001MHPjr001 Posts: 7Questions: 3Answers: 0

Hi Allan,

In my specific scenario, the end-user clicks the Delete button in the "Are you sure?" dialog that comes standard with the Editor. The server-side logic validates and returns an error in the fieldErrors array. See the code snippet below:

                success: function (result) {
                    if (result.editorAction === "remove") {
                        if (result.fieldErrors) {
                            result.fieldErrors = null;
                            alert("This record cannot be deleted because at least 1 active employee uses the Ax Financial Dimension value.");
                        }
                    }
                    // hook back into datatables editor here
                    successCallback(result);
                },

This is fine, except I would prefer to:
(1) Put the error message on the dialog box itself instead of using a JavaScript alert
(2) Show a special check-box control that would allow the end-user to "force" the delete anyway
(3) Have a "cancel" button on the dialog as another way to exit the delete dialog

Thoughts?

Thanks,
Mike

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Hi Mike,

    Put the error message on the dialog box itself instead of using a JavaScript alert

    Use error()

    Show a special check-box control that would allow the end-user to "force" the delete anyway

    This is the more tricky one. You would need to use message() to insert the checkbox and then ajax.data to add the checkbox information to the Ajax request so the server can see it and allow the delete to happen.

    Have a "cancel" button on the dialog as another way to exit the delete dialog

    Use buttons() or the buttons option in the form-options that is used for the delete.

    Regards,
    Allan

This discussion has been closed.