Dialog, popup to confirm choice

Hi guys,
I have got a button in the edit form. It's called "Informovat," and when I click on this button, a small popup or modal shows up, and the user should have the choice to choose "Yes" or "No" - based on it, I will update another field or not.
Something like this does not work.

window.informovat = () => {
const elInformovat = fd.control("butInformovat").$el;
fd.field("boolInformovano").value = 1;
$(elInformovat).dialog({
resizable: false,
height: "auto",
width: 400,
modal: true,
buttons: {
"Yes": function () {
.......
},
Cancel: function () {
$(this).dialog("close");
},
},
});
};

Could you help me?
Or I can use Dialog.open(), but I do not need to open another form, just a modal with confirmation.
I would appreciate your help on how to proceed.
Thank you so much.
Steo

Hello @Stepan,

You can use the default confirmation box:

if (confirm('Are you sure you want to submit the form?')) {
    //do something
}

Or try out the Kendo Dialog.

Add the element with the following code to the form using HTML control:

<div id="dialog"></div>

This code to the JavaScript editor:

window.$ = $;

fd.spRendered(function() {
    $("#dialog").kendoDialog({
        width: "400px",
        title: "Software Update",
        closable: false,
        visible: false,
        modal: true,
        content: "<p>Do you confirm this action?<p>",
        actions: [{
                text: 'NO'
            },
            {
                text: 'OK',
                primary: true,
                action: function(e) {
                    //do something
                    fd.field('Title').value = 12;
                    return true;
                }
            }
        ]
    });
});

And this code to the button's Click property:

var dialog = $("#dialog").data("kendoDialog");
dialog.open();
1 Like

Thank you @mnikitina ,
I will try that as soon as possible, but it looks very promising :slight_smile:
Steo

1 Like