Ticket #3266 (closed bug: invalid)
dialog popup box does not work like javascript confirm
| Reported by: | khmerler2004 | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | core | Version: | 1.2.6 |
| Keywords: | Cc: | khmerler2004 | |
| Blocking: | Blocked by: |
Description
Hello
When I download the dialog pop up, it does not work like javascript confirm.
For example, var str=1; var str=confirm('do you want to delete'); alert(str);
Base on the code above, the str variable is waiting for a confirm from your interaction. If user do not click on ok or cancel, the alert(str) won't get execute.
In jquery, it execute alert(str) at the same time as pop up.
Like this
var str = 1; $("#example").dialog({title:'This my pop box',height:400,width:400, modal:false, buttons:{"Ok": function() { str='yes'; }, "Cancel": function() { $(this).dialog("close"); } } });
alert(str);
When the first time you call the page, the alert(str)is 1 when you click on yes.
Change History
comment:2 Changed 5 years ago by flesler
- Cc khmerler2004 added
- Status changed from new to closed
- Resolution set to invalid
It's impossible to make modal dialogs like confirm. Javascript execution cannot be stopped. If you have anything else to add, please repost to the UI Bug Tracker.
comment:3 Changed 5 years ago by nathanhammon
Also, something like this may get you the functionality you want (untested):
var str = 1;
$("#example").dialog({
title:'This my pop box',
height:400,
width:400,
modal:true,
buttons: {
"Ok": function() { str='yes'; alert(str); },
"Cancel": function() { $(this).dialog("close"); }
}
});
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

I am looking for a dialog pop up that would work the same as javascript confirm function.