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

Drop-in replacement of the JavaScript window.confirm dialog box

Expand Messages
  • memorathoner
    I am trying to implement a drop-in replacement of the JavaScript window.confirm dialog box based on Dav s example available @
    Message 1 of 1 , Mar 2 3:56 AM
    • 0 Attachment
      I am trying to implement a drop-in replacement of the JavaScript
      window.confirm dialog box based on Dav's example available @
      http://blog.davglass.com/files/yui/widget_alert/

      My problem is that it does not show; it is rendered though (from the
      technical point of view,
      no visibility: visible CSS property is added to the dialog box'es
      container). I am at a loss to understand the underlying reason.

      Here goes the code:

      <pre>
      (function() {
      YAHOO.namespace("fotoakademickie.widget.dialog");
      var fnYes = function() {
      this.hide();
      return true
      },
      fnNo = function() {
      this.hide();
      return false
      },
      aConfirmDialogButtons = [
      {
      text: "Tak",
      handler: fnYes
      },
      {
      text: "Nie",
      handler: fnNo,
      isDefault: true
      },
      {
      text: "Anuluj",
      handler: fnNo
      }
      ],
      oConfirmDialogShowHideEffect = {
      effect: YAHOO.widget.ContainerEffect.FADE,
      duration: 0.25
      },
      oConfirmDialogConfig = {
      icon: YAHOO.widget.SimpleDialog.ICON_HELP,
      buttons: aConfirmDialogButtons,
      visible: false,
      effect: oConfirmDialogShowHideEffect,
      zIndex: 999,
      constraintoviewport: true,
      close: true,
      modal: true
      }

      YAHOO.fotoakademickie.widget.dialog.confirm = new
      YAHOO.widget.SimpleDialog("dialogConfirm", oConfirmDialogConfig);
      YAHOO.fotoakademickie.widget.dialog.confirm.render(document.body);

      window.confirm = function(sHeader, sBody, aContextEl) {
      YAHOO.fotoakademickie.widget.dialog.confirm.setHeader(sHeader);
      YAHOO.fotoakademickie.widget.dialog.confirm.setBody(sBody);
      YAHOO.fotoakademickie.widget.dialog.confirm.cfg.setProperty("icon",
      YAHOO.widget.SimpleDialog.ICON_HELP);

      YAHOO.fotoakademickie.widget.dialog.confirm.cfg.setProperty("context",
      aContextEl);
      YAHOO.fotoakademickie.widget.dialog.confirm.render(document.body);
      if (YAHOO.fotoakademickie.widget.dialog.confirm.bringToTop) {
      YAHOO.fotoakademickie.widget.dialog.confirm.bringToTop()
      }
      YAHOO.fotoakademickie.widget.dialog.confirm.show()
      }
      })();
      </pre>
    Your message has been successfully submitted and would be delivered to recipients shortly.