Loading ...
Sorry, an error occurred while loading the content.
 

BUG: SimpleDialog and IE

Expand Messages
  • dghcasp
    If you create a SimpleDialog that only has one button, IE6 will stop with a javascript error when .render() is called. Mozilla doesn t have this problem. IE
    Message 1 of 1 , Jun 28, 2006
      If you create a SimpleDialog that only has one button, IE6 will stop
      with a javascript error when .render() is called. Mozilla doesn't have
      this problem.

      IE Version: 6.0.2900.2180.xpsp_sp2_gdr.050301-1519
      YUI Version: 0.10

      Error Location in container.js:
      -------------------------------------------------------------------
      YAHOO.widget.Dialog.prototype.configButtons = function(type, args, obj) {
      var buttons = args[0];
      if (buttons != "none") {
      this.buttonSpan = null;
      this.buttonSpan = document.createElement("SPAN");
      this.buttonSpan.className = "button-group";

      for (var b=0;b<buttons.length;b++) {
      var button = buttons[b];

      var htmlButton = document.createElement("BUTTON");

      ERROR>>>> if (button.isDefault) {
      htmlButton.className = "default";
      this.defaultHtmlButton = htmlButton;
      }
      ----------------------------------------------------------------

      Demo Code:
      -----------------------------------------------------------------
      errorDialog("my title", "a test dialog");

      function errorDialog(title, body) {
      theErrorDialog = new YAHOO.widget.SimpleDialog("ErrorDialog",
      {
      width: "20em",
      fixedcenter:true,
      modal:true,
      draggable:false
      }
      );
      if (! theErrorDialog) {
      alert("Can't create error dialog.<p>Message was: " + body);
      return;
      }

      theErrorDialog.setHeader(title);
      theErrorDialog.setBody(body);

      var buttons = [
      { text:"OK", handler:errorDialogOk, isDefault:true },
      /*{ text:"Cancel", handler:errorDialogOk } */
      ];
      theErrorDialog.cfg.queueProperty("buttons", buttons);

      theErrorDialog.render(document.body); /* HANGS HERE */
      theErrorDialog.show();
      }

      function errorDialogOk() {
      this.hide();
      }

      -------------------------------------------------------------------

      If the "Cancel" button above is added, it works perfectly in IE.
    Your message has been successfully submitted and would be delivered to recipients shortly.