Property sheet - validation of controls

I have successfully implemented validation within a form, but can I use the same approach to controls within a property sheet? have tried different ways but to no success (other than explicitly validating each and every control within the property sheet, which I prefer not to do). Tried to contain a property sheet as the (only) element within a form, but that does not seem to work either

You need to create a custom component that inherits from the webix.ui.property and webix.ValidateData. After that, you can implement the validation as usual. Check the snippet:

http://webix.com/snippet/041c1344

hi Listopad,

Brilliant, thank you. Can you also explain the best method to apply a different css to controls (i.e. the red background) that have errors? Similar to how it works within forms?

In your snippet, it only works if I set the “rules” attribute on the property sheet, I can’t use the “validate” attribute on each control - is that right?

Probably the best solution - onValidationError event. It can catch IDs of the invalid controls, so you can use it to set the custom css.

http://webix.com/snippet/1924604c

Nice one - thank you very much.