Clear Validation for a single form element

I would like to clear validation for a single form element when some event happens. For my use case, clearing the validation of the entire form will not work. Simply validating the element by itself won’t work either, because at the time that I am trying to clear the validation, it is not valid. I thought that the built in ui.form clearValidation() function should offer a way to target a single form element (much like the ui.form validate() does).

Here’s a snippet Code Snippet

In this example, please click “Validate form” with both text fields empty. Then click “clear validation for text 2” and notice that only the last solution will retain the validation error for text 1 while clearing the validation on text 2.

Is there a way to use webix to clear the validation from one single form element without affecting the others? Must I just get the node and remove the webix_invalid class from it?

Hello,

Indeed, the clearValidation() method is applied to the whole form rather then to a separate input. At the same time, removing the “webix_invalid” class clears just highlighting, but the input itself stays invalid.

The correct approach is to call the markInvalid() method of the UI form:

this.getFormView().markInvalid("text2", false);

Please, check hte following snippet: https://webix.com/snippet/4bef997e

Thank you Helga, this solved my problem!