Answer the question
In order to leave comments, you need to log in
How to setup form validation (Vue, Element)?
The code is 90% the same as the example from the documentation
https://jsfiddle.net/st56h3ky/
The only difference is that I have added a new nesting level. Namely, dynamicValidateForm
nested in MainForm
.
However, I am getting an error Cannot read property 'domains' of undefined
.
The task is simple - to validate the nested object.
If you remove the nesting of MainForm, then everything works, but I need it with it.
I suspect that the problem is somewhere here: :prop="'domains.' + index + '.value'"
.
Answer the question
In order to leave comments, you need to log in
:model="MainForm"
Should be
instead :model="MainForm.dynamicValidateForm"
.
And :rules="rules"
replace with :rules="rules.value"
.
UPD. Taken from the comments:
can I refer:model="MainForm"
in the main form, and pass it to propsdynamicValidateForm
:prop="`dynamicValidateForm.domains.${index}.value`"
Do you have all this code in .vue format in your project? If so, then data must be a function, not an object.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question