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

Change CSS from javascript

4 Answers 190 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 29 Jan 2015, 03:44 PM
Hi,

On validation fail I would like to switch the css class of the raddropdowntree in order to end up with a red border.  

I am trying the following but not sure if it is my code or the css that is to blame. Any suggestions?

             
                    function RadDropDownTree_ValidationStyleSetter(textBox, eventArgs) {
                        if (eventArgs.IsValid === false) {
                            textBox.addCssClass('RadDropDownTreeFieldErrorHighlight');
                        } else {
                            textBox.removeCssClass('RadDropDownTreeFieldErrorHighlight');
                        }
                    }

Regards

Jon


4 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 03 Feb 2015, 08:49 AM
Hello Jon,

You can use jQuery and the rddtInner selector, in order to manage the css of the controls by adding and removing a custom css class. This class should have the border-color set to red. In the attachment, you can find a simplified runnable sample demonstrating the implementation of the suggested approach at the change event of a checkbox.

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jon
Top achievements
Rank 1
answered on 03 Feb 2015, 09:19 AM
Hi Nencho,

Many thanks for that.  A very helpful mechanism.

Do you know if there is any movement towards having a more integrated set of validation mechanisms built into the various editor controls?

Best Regards

Jon



0
Nencho
Telerik team
answered on 06 Feb 2015, 08:05 AM
Hello Jon,

I am afraid that there probably won't be any further implementations regarding the validation of the controls as this implementation might differ in some scenarios. This is why we leave the ability for custom handling of the validation scenario.

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jon
Top achievements
Rank 1
answered on 06 Feb 2015, 08:38 AM
Ah OK,

Not to worry :)
Tags
DropDownTree
Asked by
Jon
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Jon
Top achievements
Rank 1
Share this question
or