I would like to pass the function some javascript to be executed when the user presses one of the buttons, but currently when I press the "No" or "Yes" buttons on the dialog box nothing happens, it just sits there...no error shows in firebug. If I hard code "alert('hi')" into the dialog button it works fine, so there must be something in passing the javascript as part of the function parameters.
How can I get this to work? Thanks in advance.
Heres my javascript function:
function confirm_yes_no(xtitle,msg, btn_yes_txt, btn_no_txt, btn_yes_js, btn_no_js)
{
var button_yes = btn_yes_txt;
var button_no = btn_no_txt;
var dialog_buttons = {};
dialog_buttons[button_yes] = function(){ btn_yes_js }
dialog_buttons[button_no] = function(){ btn_no_js }
$("#modal_confirm_yes_no").html(msg);
$("#modal_confirm_yes_no").dialog({
title: xtitle,
bgiframe: true,
autoOpen: false,
height: 150,
width: 300,
modal: true,
buttons: dialog_buttons
});
$("#modal_confirm_yes_no").dialog("open");
}
Here's how I call the function:
confirm_yes_no("Print Checks", "Would you like to print checks now?", "Yes", "No", "alert('you clicked yes');", "alert('you clicked no');");