PDA

View Full Version : [4.0.2] errorchange event and custom invalidCls - requires calling validate() twice



wiz61
20 Jun 2011, 10:33 AM
I have a requirement to modify the invalidCls based upon whether a field is required or desired (changing the border color, and in both cases getting rid of the squiggley line).

I have written a plugin to provide this functionality to our forms. In the form I am manually calling validate() for each field on the form (validateonchange and validateonblur are off). I can listen to the "errorchange" event and set the invalidCls as required. However, the control does not reflect the change UNLESS I do another validate() immediately after the call that made the change. It appears that the addCls() in renderActiveError() does nothing, as the invalidCls is is applied before the function is reached. Performing another validation then uses the one I set. It would be okay if there was a beforeerrorchange event (or another where I could change the invalidCls), but I can't find such an event.

Calling validate() twice works, but seems like an unnecessary hack.