Posted 02 Dec 2011
Link to this post
Solved this, idiotically. This begs for a cleaner solution inside RadInputControl.
I've created a class, RadInputValidationDecorator, which inherits from Control. It internally creates a CustomValidator subclass, which invokes a JS function on validation. This validation function is always valid. Instead, it loops over the target controls' Validators array, and checks isvalid on each object. If any are invalid, it sets ._invalid to true on the RadInput, and then .updateCssClasses(). This causes the appearence change I'm looking for. It also does the same on the server side, on PreRender, it checks whether all associated Validators (other than itself) with the RadInput are valid, if not, it injects some JS which sets _invalid on the client side when the page is first loaded.
My solution relies on the Decorator being created and added to the Controls collection AFTER all other validators for the control, otherwise it's validation logic will be fired before the other validators have had a chance to set their 'isvalid' value. This is kind of hacky, but I can't figure out any other way to inject myself into the client side validation logic.
I guess I could have javascript that resorts Page_Validators and control.Validators on load. Sounds even more hacky, but is probably the only real solution.
This is hacky and lame. A RadInput control should be smart enough to change it's own state to invalid when a validator hooked up to it fails. What I ended up doing is something the RadInput itself could do, perhaps by adding itself to it's own Validators collection, to participate in Page validation, or something.
Anyways, problem sort of solved.