Hi Jack,
I am using yui basic dialog and on clicking complete button each time my dialog moves up. How can i fix this prob? Plz help...
this is my code
//var flagForSave = 0; //This variable is used as indication whether any report is been saved as complete
//var flagToKnowIfNewSaveAgain = "no";
YAHOO.namespace(
"example.container");
function
init() {
// Define various event handlers for Dialog
var handleYes = function() {
var choice="draft";
savereport(choice,flagToKnowIfNewSaveAgain);
if(flagForSave == 1){// This is again if the cycle of save happens after complete
YAHOO.example.container.simpledialog1.setBody(
"Please select your Choice !");
flagToKnowIfNewSaveAgain = "no";
flagForSave = 0;
}
this.hide();
};
var handleNo = function() {
YAHOO.example.container.simpledialog1.setBody("This report will be stored as a new Report.Please Enter your choice?");
var choice="final";
savereport(choice,flagToKnowIfNewSaveAgain);
if(flagForSave == 0){
flagForSave = 1;// Means report is saved as complete once
flagToKnowIfNewSaveAgain = "yes";
}
this.hide();
};
var cancel1 = function(){
this.hide();
};
// Instantiate the Dialog
YAHOO.example.container.simpledialog1 = new YAHOO.widget.SimpleDialog("simpledialog1",
{ width: "300px",
fixedcenter: true,
visible: false,
draggable: false,
zIndex: 15000,
modal: true,
close: true,
text: "Please select your Choice !",
icon: YAHOO.widget.SimpleDialog.ICON_HELP,
constraintoviewport: true,
buttons: [ { text:"As Draft", handler:handleYes, isDefault:false },
{ text:"Complete", handler:handleNo },
{ text:"Cancel", handler:cancel1} ]
} );
YAHOO.example.container.simpledialog1.setHeader("How would you like to save the Report?");
// Render the Dialog
YAHOO.example.container.simpledialog1.render(document.body);
YAHOO.util.Event.addListener("show", "click", YAHOO.example.container.simpledialog1.show, YAHOO.example.container.simpledialog1, true);
//YAHOO.util.Event.addListener("hide", "click", YAHOO.example.container.simpledialog1.hide, YAHOO.example.container.simpledialog1, true);
}
YAHOO.util.Event.addListener(window,
"load", init);