Hello dear webix team,
I created a custom form component where i add some subviews into the view.
When i now call the forms validate function i get error "“Validation works only for fields in the form”.
I understand that i could overwrite the getFormView function but i have no idea how to get the parent form. Even when trying to queryView({ view: “form” }, “parent”) i cannot get the form containing the component.
Tried to reproduce the problem in the snippet: Code Snippet but here the error does not appear.
Hope you can help me.
Hello Mimu1988,
In your example you inherit the component from both ui.text and ui.layout
This may cause errors due to conflicts of the API collected in one widget. So the better way in your case is to inherit only from ui.layout.
It will also be useful to add the $allowsClear property to the new widget. It is necessary because when the parent form is cleared, the value of this input will also be reset:
webix.protoUI({
name: "customtext",
$allowsClear:true,
And to make the validation work you need to set rules for the form and name property for the text view as the key of the rules object should be the same as the name property of the text input.
If the problem persists, please let me know what the error is.
Please check the example: Code Snippet