Enable/Disable decorated buttons on the Client

3 posts, 0 answers
  1. Jon
    Jon avatar
    12 posts
    Member since:
    May 2008

    Posted 30 May 2008 Link to this post

    Just started playing with your suite yesterday and I am very impressed, keep up the good work.

    I noticed that while enabling or disabling a button on the client the button's style was not being updated.  Of course the exception being if the script ran before the page load, this makes sense since it was before the decorator starts doing its magic.

    I created the following helper functions that I can call to disable/enable a button.
    This wasn't my first choice, due to hard coding class names I have no control over but it works.
    //disables a button that has been decorated with the RadFormDecorator 
    function disableButton(button, decorator) 
        var btnDisabledClass = 'radfdSkinnedFormButton radfd_<%=ConfigurationSettings.AppSettings["Telerik.Skin"]%> radfdInputDisabled'
        decorator.className = btnDisabledClass;  
    //enables a button that has been decorated with the RadFormDecorator 
    function enableButton(button, decorator) 
        var btnEnabledClass = 'radfdSkinnedFormButton radfd_<%=ConfigurationSettings.AppSettings["Telerik.Skin"]%>'
        decorator.className = btnEnabledClass;  

    I am having issues finding the decorator element that I pass as the second param. I have resorted to hardcoding the client IDs (eww).
    var decRemoveMembersFromRole =  document.getElementById("Skinnedctl00_cphPage_ctl00_btnRemoveMembersFromRole"); 

    Any suggestions, am I missing something?

    Keep up the good work!

  2. Tervel
    Tervel avatar
    1337 posts

    Posted 03 Jun 2008 Link to this post

    Hi Marc,

    We are glad to hear that you like the controls. The FormDecorator is a new one, just added to the suite and we plan a great deal of further enhancements, to make it integrate truly seamlessly in all scenarios.

    At present our focus is at eliminating the short flicker that appears when the page loads, as the decorator takes some time to replace the default browser elements with the styled ones. Also, we plan to address the issue of elements not getting styled OK if those were originally invisible on the page, and later made visible with script.

    Regarding your question how to obtain a reference to the decorated button -  the decorated button elements are inserted before the original input element - that is, you can use the original button for the purpose, e.g.

    var decorator = button.previousSibling;

    Best wishes,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Jon
    Jon avatar
    12 posts
    Member since:
    May 2008

    Posted 03 Jun 2008 Link to this post

    Excellent, thanks for the response.
Back to Top