"OK " and "Cancel " Issues in the bullet box

Requirement: There is a button, click on this button, ask whether a value in this button is zero, and then confirm whether a confirmation box pops up, if there is a confirmation box, then click OK, jump to the next page, click Cancel do not jump page. (Is there a new way of thinking or a solution?) I wrote the frame in button's confirmation message, but the number of judging conditions was not on the outside.

I was written in button logic, with JS)

1. Now I have found a way to eject the confirmation box, but when clicking OK and Cancel, go straight in one direction.

2. I first used the JS method, popped up the confirmation box, and wrote a hidden input stored the Click OK or cancel value, but for the first time, the value of this input and

Did not get, click button again, this time can get the first click after the JS assigned to the input value, this is wrong. In 

3.outsystem, write Window.close () or window.onbeforeunload=close in the cancel condition in JS cannot directly cancel the bullet box.It will shut down directly. Also page.

4.The effect is like this, OK goes to the next page, the Cancle page remains the same

5.I wrote the JS:

Sorry, but it's not clear what your question is, and how it relates to OutSystems.

What are you trying to accomplish? Not sure jumping straight to JavaScript is ideal, but it's not clear from your requirements exactly what you're trying to do.