How can I make DialogBox (confirmation message and OK & Cancel buttons) wait for user action and return boolean result (true is OK was clicked, false otherwise)?
Thanks in advance.
How can I make DialogBox (confirmation message and OK & Cancel buttons) wait for user action and return boolean result (true is OK was clicked, false otherwise)?
Thanks in advance.
The simplest way to do this is to use Window.confirm
, which "Displays a message in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons."
Other way would be to split your code and put all that which has to be executed after ok/cancel click in a callback. Execute the callback in the ok/cancel handlers of the dialog box.