This is a migrated thread and some comments may be shown as answers.

Enable/Disable decorated buttons on the Client

2 Answers 138 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 2
Jon asked on 30 May 2008, 11:11 PM
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'
    button.disabled=true
    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"]%>'
    button.disabled=false
    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!
Marc

2 Answers, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 03 Jun 2008, 08:55 AM
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,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jon
Top achievements
Rank 2
answered on 03 Jun 2008, 05:01 PM
Excellent, thanks for the response.
Tags
FormDecorator
Asked by
Jon
Top achievements
Rank 2
Answers by
Tervel
Telerik team
Jon
Top achievements
Rank 2
Share this question
or