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

Re: Disabling a dialog's buttons after instantiation

Expand Messages
  • logicaloctopus
    ... (that ... run ... for ... {visible:false,fixedcenter:true,width: 400px ,modal:true}); ...
    Message 1 of 2 , Aug 21, 2008
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "logicaloctopus"
      <logicaloctopus@...> wrote:
      > In certain cases I want one of my dialog's buttons to be disabled
      > is, greyed out and unclickable). But I want to set this property at
      > time, as it should normally be available, and only under certain
      > circumstances should be made unavailable (and then made reavailable
      > subsequent use). I instantiate my dialog and its buttons like this:
      > ----------------
      > YAHOO.namespace("scai");
      > this.editDialogButtons = [
      > { text:"Save", handler:btnSave,
      > isDefault:true },
      > { text:"Delete", handler:btnDelete },
      > { text:"Cancel", handler:btnCancel }
      > ];
      > YAHOO.scai.editDialogObj = new YAHOO.widget.Dialog("editDialog",
      > YAHOO.scai.editDialogObj.render();
      > -----------------
      > So, what is the proper way to disable the Delete button? And then
      > reenable it? Thanks in advance for any insight.

      Just as a follow up I did try the following:
      var oBtnDelete = YAHOO.scai.editDialogObj.getButtons()[1];

      It doesn't seem to work. I get the first alert box popping up, and the
      oBtnDelete var seems to be not an object but an HTML entity so, in fact,
      I get the innerHTML property successfully, which is, in this case,
      'Delete'. But the 'set' method fails without any sort of error being
      produced. My Firefox Error Console has nothing to report and neither
      does my Firebug plugin! The first alert box displays '1:Delete' but the
      second never appears. The code seems to just get swallowed up when I
      call the 'set' method. I suppose that is what I would expect if
      oBtnDelete is not an object? So my problem remains. Can anybody help me
    Your message has been successfully submitted and would be delivered to recipients shortly.