...

View Full Version : jquery UI confirmation dialog instead of confirm()



jlsjonas
09-26-2010, 10:28 PM
Hello coders,

a friend of me asked for a little help,
he had a confirm() dialog in javascript to confirm a deletion
however he wants to use jqueryui dialog modal-confirmation (http://jqueryui.com/demos/dialog/#modal-confirmation)

the problem is that we can't get it working
I hope that you guys can help

'working' script with confirm():

<script type="text/javascript" >
function deleterow(id){
if (confirm('Ben je zeker dat je deze gebruiker wilt verwijderen?')) {
$.post('quit.php', {id: +id, ajax: 'true' },
function(){
$("."+id).fadeOut("slow");
$(".message").fadeIn("slow");
$(".message").delay(2000).fadeOut(1000);
});
}

}
</script>


above code works, but uses a simple confirm() dialog

several attempts in making it work with JQUI failed

one of the attempts:

<script type="text/javascript" >
function deleteconfirmed(id){
document.write("Hello World!");
$.post('quit.php', {id: +id, ajax: 'true' },
function(){
$("."+id).fadeOut("slow");
$(".message").fadeIn("slow");
$(".message").delay(2000).fadeOut(1000);
});
}
$(function() {
$( "#dialog-confirm" ).dialog({
autoOpen: false,
resizable: false,
height:140,
modal: true,
buttons: {
"Delete item": function() {
deleteconfirmed();
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});

function deleterow(id){
$('#dialog-confirm').dialog('open');
return false;
}
});
</script>


Please help us out,
Best Regards, JLS Jonas

Philip M
09-27-2010, 12:18 PM
Suggest you post this in the jQuery (Javascript Frameworks) section of this forum. Ask a mod to move you over.

jlsjonas
09-27-2010, 07:45 PM
Suggest you post this in the jQuery (Javascript Frameworks) section of this forum. Ask a mod to move you over.

mod, could you move the topic over? ty

& note to others: I'd like it with the jQUI, not another type

Ty

SB65
09-27-2010, 07:58 PM
I think you'll find it has already been moved...

Can't immediately see anything wrong with your code. What happens - just nothing, no dialog?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum