Hi,
I have a application with many dialogs and created a function to open a dialog and also load data into it, so other functions could open a dialog and process the users option.
The problem is when I call openDialog it stops the function that called it. I thought by adding a return value so when a button is clicked the calling function can process the users response.
function customer_crud(op)
{
var formData = $("#customer_details_form").serialize();
var debugData = formData.replace(/&/g,'<br />');
var text = "<p>Customer Function: " + op + "</p><p>" + debugData + "</p>";
if(openDialog('DEBUG', text)){
alert("TRUE");
} else {
alert("FALSE");
}
}
function openDialog(title, text) {
var dialogOpts = {
title: title,
modal: true,
autoOpen: false,
buttons: {
"Delete all items": function() {
$( this ).dialog( "close" );
return true;
},
Cancel: function() {
$( this ).dialog( "close" );
return false
}
}
};
$("#dialog").dialog(dialogOpts);
$("#dialog").html(text).dialog('open');
}
The above code opens the dialog but throws false before anything is selected. If someone could please help me or sugguest a better way I would be greatful.
I plan to pass dialogOpts to the function but placed it in there for testing.
Thanks