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

RE: [ydn-javascript] Changing text of SimpleDialog before showing

Expand Messages
  • Steven Peterson
    It shouldn t have any bad effects, but you should never call setBody on a SimpleDialog. The only two properties you should need to use for content are icon
    Message 1 of 5 , Jul 28, 2006

      It shouldn’t have any bad effects, but you should never call setBody on a SimpleDialog. The only two properties you should need to use for content are “icon” and “text”. If you do that, and remove the setBody, you should be okay.

       

      Steven Peterson

      Web Developer, Platform Engineering

      Yahoo!

       

       

       

      From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of Michael Price
      Sent: Friday, July 28, 2006 3:22 AM
      To: ydn-javascript@yahoogroups.com
      Subject: Re: [ydn-javascript] Changing text of SimpleDialog before showing

       

      Hi again,
      Solved my problem by wrapping the dialog creation and display in a function:

      // YAHOO BUTTON HANDLER
      var ySDCallback = function() {
      this.hide();
      }

      // YAHOO DIALOGS
      theButton = [
      { text: "OK", handler: ySDCallback }
      ];

      function showDialog(icon,title,text) {
      theDialog = new YAHOO.widget.SimpleDialog("dlgx",
      {
      visible: false,
      width: "30em",
      effect: { effect:YAHOO.widget.ContainerEffect.FADE, duration:0.1 },
      fixedcenter:true,
      modal:true,
      draggable:false
      }
      );

      theDialog.setHeader(title);
      theDialog.setBody(text);
      theDialog.cfg.queueProperty("icon",icon);
      theDialog.cfg.queueProperty("buttons",theButton);

      theDialog.render(document.body);
      theDialog.show();
      }

      var yCallbackCD = {
      success: function(o) {
      switch (o.responseText) {
      case "Y":
      showDialog(YAHOO.widget.SimpleDialog.ICON_INFO,"Details Saved","The
      details were saved successfully");
      break;
      case "N":
      showDialog(YAHOO.widget.SimpleDialog.ICON_WARN,"An Error
      Occured","There was a problem saving the details.<br />Please recheck
      the form and try again.");
      break;
      }
      },

      failure: function(o) {
      alert("There was a problem communicating with the server. Please try
      again in a few minutes.");
      }
      }

      Is this going to have any unwanted side effects?

      Regards,
      Michael Price

    Your message has been successfully submitted and would be delivered to recipients shortly.