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

Re: [ydn-javascript] Re: Cannot disable YAHOO.widget.Button

Expand Messages
  • Todd Kloots
    dpotluri - Regarding your YUI Buttons not being disabled: I put together a simple example page using your code and could not reproduce the problem in either
    Message 1 of 4 , Dec 9, 2008
    • 0 Attachment
      "dpotluri" - 

      Regarding your YUI Buttons not being disabled:

      I put together a simple example page using your code and could not reproduce the problem in either YUI 2.5.2 or YUI 2.6.2.  Here is the example:


      Regarding the syntax for toggling the disabled attribute of a Button instance:  You should use the "set" method:

      yuiReset.set("disabled", true);

      You were using:

      yuiReset.disabled = true;

      The latter is NOT valid.  See the "Configuration Attributes" section of the Button landing page for more: http://developer.yahoo.com/yui/button/#configurationattributes


      I would bet that you made one of the following mistakes:

      1) You forgot to include the CSS for YUI Button

      2) You included the CSS for YUI Button, but forgot to add the "yui-skin-sam" class name to the parent element of the markup for the YUI Buttons

      3) You were creating your own custom skin for YUI Buttons and forgot to provide a disabled style.  See the section of the Button landing page title "Styling State" for more info: http://developer.yahoo.com/yui/button/#stylingstate

      - Todd


      On Oct 26, 2008, at 9:57 PM, D. Wayne Fincher wrote:

      I can't see anything that would cause those methods to fail.

      But, what I have found can make a button's styling not respond
      properly is when the button's css styles have been overridden. If you
      have overridden the styles, check and see if you have the disabled
      styles set.

      I know this is a long shot answer (obviously the button would be
      disabled, but wouldn't look disabled if my answer turns out to be
      correct.), but looking over code that I have used which was based on
      YUI 2.5.2 works pretty much the way you have your code.

      The only other thing I can think of is maybe it's something that was
      broken before YUI 2.5.2

      Sorry I couldn't nail it down any better than that.

      As a last resort, can you try putting --disabled-- or
      --disabled=" disabled" -- into the HTML markup? Perhaps that does the
      trick for you.

      --- In ydn-javascript@ yahoogroups. com, "dpotluri" <dpotluri@.. .> wrote:
      >
      > I also tried using yuiReset.set( "disabled", false );
      > 
      > None of the three options i tried works.
      > 
      > I am using 2.5.0 code base of YUI.
      > 
      > Thx!
      > 
      > 
      > 
      > --- In ydn-javascript@ yahoogroups. com, "dpotluri" <dpotluri@> wrote:
      > >
      > > 
      > > As a novice, i am trying to create some buttons and disable them. I
      > > am able to create them fine, but i am not able to disable them either
      > > during YAHOO.widget. Button creation (via the constructor) or post
      > > creation. Any thoughts on why this is the case? 
      > > 
      > > Thanks in advance,
      > > 
      > > Here is the code:
      > > -----
      > > <script type="text/javascri pt">
      > > 
      > > YAHOO.namespace( "yuibook. buttons") ;
      > > 
      > > YAHOO.yuibook. buttons.initButt ons = function()
      > > {
      > > var yuiReset = new YAHOO.widget. Button("myReset" , {disabled:true} );
      > > var yuiSubmit = new YAHOO.widget. Button("mySubmit ", {disabled:true} );
      > > 
      > > yuiReset.disabled = true;
      > > }
      > > 
      > > 
      > >
      >
      YAHOO.util.Event. onContentReady( "buttons" ,YAHOO.yuibook. buttons.initButt ons
      > > );
      > > 
      > > </script>
      > > 
      > > Here is the HTML snipet
      > > ------------ ----
      > > <div id="buttons" >
      > > <button type="reset" id="myReset" name="myReset" >ResetMe< /button>
      > > <button type="submit" id="mySubmit" name="mySubmit" >Submit</ button>
      > > </div>
      > >
      >


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