160
Views
16
Comments
Solved
Bug After cancelling the confirmation dialog

Hello,

I found out a bug using the button loading.

If I display a confirmation message, and select the Cancel option, the button will load indefinitely.

Thanks



Anotao20200406173953.png
2026-01-19 17-09-56
Carlos Lessa
 
MVP
Solution

check this links, I think there you will find the way to create your custom confirmation dialog with JS:

https://stackoverflow.com/questions/3886228/overriding-javascript-confirm-while-preserving-the-callback

https://learnersbucket.com/examples/bootstrap4/custom-confirm-box-with-bootstrap/

https://stackoverflow.com/questions/37814999/getting-a-callback-function-to-trigger-after-clicking-on-an-alert-with-jquery

something like these:

myCustomConfirm("Are you sure?", function (confirmed) {
    if (confirmed) {
        // Whatever you need to do if they clicked confirm
    } else {
        // Whatever you need to do if they clicked cancel
    }
});

or

function myCustomConfirm(message, callback) {
    var confirmButton, cancelButton;

    // Create user interface, display message, etc.

    confirmButton.onclick = function() { callback(true); };
    cancelButton.onclick = function() { callback(false); };
}
2020-03-01 17-52-33
Nikhil Gaur

Hi Sergio,

You must have set a boolean local variable to your buttonloading. So when you cancel the dialog, that time you also have to set the boolean variable to false.

2023-12-28 16-01-00
Sérgio Trindade

Nikhil Gaur wrote:

Hi Sergio,

You must have set a boolean local variable to your buttonloading. So when you cancel the dialog, that time you also have to set the boolean variable to false.

Hello


Yes, I have obviously set a boolean variable to buttonloading, otherwise it wouldn't be possible to use the component.

So the question here is: how I can set the variable to false when I cancel the confirmation dialog?


Thanks


2020-03-01 17-52-33
Nikhil Gaur

Sérgio Trindade wrote:

Nikhil Gaur wrote:

Hi Sergio,

You must have set a boolean local variable to your buttonloading. So when you cancel the dialog, that time you also have to set the boolean variable to false.

Hello


Yes, I have obviously set a boolean variable to buttonloading, otherwise it wouldn't be possible to use the component.

So the question here is: how I can set the variable to false when I cancel the confirmation dialog?


Thanks


Yes that is what I said you are already using boolean variable so you just have to set it to false upon cancel.

From your latest comments it looks like you are using javascript confirm message box (not using outsystems model/ popup widget). Right?

If yes, then while showing confirm message you should get its result like below. If it is false then set IsLoading variable to false.

var result = confirm("Press a button!");

2023-12-28 16-01-00
Sérgio Trindade

Nikhil Gaur wrote:

Sérgio Trindade wrote:

Nikhil Gaur wrote:

Hi Sergio,

You must have set a boolean local variable to your buttonloading. So when you cancel the dialog, that time you also have to set the boolean variable to false.

Hello


Yes, I have obviously set a boolean variable to buttonloading, otherwise it wouldn't be possible to use the component.

So the question here is: how I can set the variable to false when I cancel the confirmation dialog?


Thanks


Yes that is what I said you are already using boolean variable so you just have to set it to false upon cancel.

From your latest comments it looks like you are using javascript confirm message box (not using outsystems model/ popup widget). Right?

If yes, then while showing confirm message you should get its result like below. If it is false then set IsLoading variable to false.

var result = confirm("Press a button!");

Yes im using the default confirmation message(I assume is made with Js), check picture above.

So what are you trying to say is that I'll have to write that code and adapt inside of the confirmation message, right?

2026-01-19 17-09-56
Carlos Lessa
 
MVP

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable

2023-12-28 16-01-00
Sérgio Trindade

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

2023-04-19 18-38-51
Bas de Jong

Sérgio Trindade wrote:

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

Hi Sergio, as far as i know there is no easy way to achieve this. It is possible however, you need to research what command OutSystems uses to display this message to you, it might be this one:

https://www.w3schools.com/jsref/met_win_confirm.asp

Which returns a boolean somewhere and you need to catch it in order to set your loading button to false again.


You also might do a different implementation which involves creating a popup in your application that basically does the same as this screen, but now you can handle the outputs and set your button loading image to False again.

2026-01-19 17-09-56
Carlos Lessa
 
MVP

Sérgio Trindade wrote:

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

So this is the confirmation message from the javascript? confirm()?

Can you change the confirmation msg for one that you control?


2023-12-28 16-01-00
Sérgio Trindade

Bas de Jong wrote:

Sérgio Trindade wrote:

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

Hi Sergio, as far as i know there is no easy way to achieve this. It is possible however, you need to research what command OutSystems uses to display this message to you, it might be this one:

https://www.w3schools.com/jsref/met_win_confirm.asp

Which returns a boolean somewhere and you need to catch it in order to set your loading button to false again.


You also might do a different implementation which involves creating a popup in your application that basically does the same as this screen, but now you can handle the outputs and set your button loading image to False again.

Hi,


Exactly, this is what I wanted to know, I had also seen this site, but so far I haven't managed to get the value true or false, when I click on the buttons in the dialog box. I had also thought about creating my own dialog window, but since the platform offers this feature, I wanted to try to go there. Anyway, thanks for your reply, I will try to wait for someone to have a solution, which in my opinion is a bug with the button loading feature.

2023-12-28 16-01-00
Sérgio Trindade

Carlos Lessa wrote:

Sérgio Trindade wrote:

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

So this is the confirmation message from the javascript? confirm()?

Can you change the confirmation msg for one that you control?


Hi,

I'm trying to use this confirmation message, I assume is made with Js yes.


2026-01-19 17-09-56
Carlos Lessa
 
MVP

Sérgio Trindade wrote:

Carlos Lessa wrote:

Sérgio Trindade wrote:

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

So this is the confirmation message from the javascript? confirm()?

Can you change the confirmation msg for one that you control?


Hi,

I'm trying to use this confirmation message, I assume is made with Js yes.


So try with one of these components for web or mobile

web - https://www.outsystems.com/forge/component-overview/717/confirmation-dialog

mobile - https://www.outsystems.com/forge/component-overview/1490/dialogsplugin

your destination will be the action that calls the popup from the components and on the callback from the popup dialogue your place your action to yes or no, or send and event to trigger the parent.

I did this many times and with this approach, you can also customize the UI for the confirmation msg


2023-12-28 16-01-00
Sérgio Trindade

Carlos Lessa wrote:

Sérgio Trindade wrote:

Carlos Lessa wrote:

Sérgio Trindade wrote:

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

So this is the confirmation message from the javascript? confirm()?

Can you change the confirmation msg for one that you control?


Hi,

I'm trying to use this confirmation message, I assume is made with Js yes.


So try with one of these components for web or mobile

web - https://www.outsystems.com/forge/component-overview/717/confirmation-dialog

mobile - https://www.outsystems.com/forge/component-overview/1490/dialogsplugin

your destination will be the action that calls the popup from the components and on the callback from the popup dialogue your place your action to yes or no, or send and event to trigger the parent.

I did this many times and with this approach, you can also customize the UI for the confirmation msg


I try to avoid forge components, and use only components made by my own.

Eventually the links you sent me above will work and I will find out how to change the behavior of the button loading component

Thanks for you help and reply.


2026-01-19 17-09-56
Carlos Lessa
 
MVP

Sérgio Trindade wrote:

Carlos Lessa wrote:

Sérgio Trindade wrote:

Carlos Lessa wrote:

Sérgio Trindade wrote:

Carlos Lessa wrote:

You set the variable inside the logic of the cancel button, if this is a web block you set an event inside the cancel button to run in the parent and change the variable


Hi,

I'm not sure, if you understand the issue. The cancel button can't have the logic associated because is not part of the outsystem's. Im referring this issue, because I can't acess the variable inside of the confirmation message dialog. Here's another example.

If I set the Ok button, the process goes okay and follows the logic associated. But If I click Cancel, the button loading, will load indefinitely and obviously stops the process, but the loading continue.

Thanks

So this is the confirmation message from the javascript? confirm()?

Can you change the confirmation msg for one that you control?


Hi,

I'm trying to use this confirmation message, I assume is made with Js yes.


So try with one of these components for web or mobile

web - https://www.outsystems.com/forge/component-overview/717/confirmation-dialog

mobile - https://www.outsystems.com/forge/component-overview/1490/dialogsplugin

your destination will be the action that calls the popup from the components and on the callback from the popup dialogue your place your action to yes or no, or send and event to trigger the parent.

I did this many times and with this approach, you can also customize the UI for the confirmation msg


I try to avoid forge components, and use only components made by my own.

Eventually the links you sent me above will work and I will find out how to change the behavior of the button loading component

Thanks for you help and reply.


Good, I could help you.

So if you use my solution or ideas, please mark my answer as the solution and help me to grow my rank in the community, thanks and good code


2026-01-19 17-09-56
Carlos Lessa
 
MVP

try to use a forge component:

web - https://www.outsystems.com/forge/component-overview/717/confirmation-dialog

mobile - https://www.outsystems.com/forge/component-overview/1490/dialogsplugin


When I need to control the action on the buttons to accept or cancel I use to do with these components change or add code to the action inside the component or an event to communicate with parents element

2026-01-19 17-09-56
Carlos Lessa
 
MVP
Solution

check this links, I think there you will find the way to create your custom confirmation dialog with JS:

https://stackoverflow.com/questions/3886228/overriding-javascript-confirm-while-preserving-the-callback

https://learnersbucket.com/examples/bootstrap4/custom-confirm-box-with-bootstrap/

https://stackoverflow.com/questions/37814999/getting-a-callback-function-to-trigger-after-clicking-on-an-alert-with-jquery

something like these:

myCustomConfirm("Are you sure?", function (confirmed) {
    if (confirmed) {
        // Whatever you need to do if they clicked confirm
    } else {
        // Whatever you need to do if they clicked cancel
    }
});

or

function myCustomConfirm(message, callback) {
    var confirmButton, cancelButton;

    // Create user interface, display message, etc.

    confirmButton.onclick = function() { callback(true); };
    cancelButton.onclick = function() { callback(false); };
}
UserImage.jpg
Daniel McMechan

Was a solution found for this issue? I am having the same problem, if user clicks cancel in the confirmation dialog, the button (with style load), loads forever. Any help would be appreciated.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.