Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Mention existance of the fields property in the Form component #11742

Closed
germansokolov13 opened this issue Jun 25, 2018 · 2 comments

Comments

@germansokolov13
Copy link

Existing Component

Yes

Component Name

Form

Description

Suppose I want to do something to a form-item in a form. I know only its prop name but don't have a ref to it. If I have a ref to the form I could access its form-item like this:

this.$refs.form.fields[prop]

Than I could invoke clearValidate for instance for a single field. But this is somewhat wrong because existence of the fields property in form is not documented. Maybe add some getter for form-items to form or mention fields property in docs?

@Leopoldthecoder
Copy link
Contributor

I know only its prop name but don't have a ref to it

Could you give an example why you can't add a ref to a certain <el-form-item>?

form.fields is not meant to be exposed to users.

@germansokolov13
Copy link
Author

germansokolov13 commented Jun 26, 2018

Suppose I have a lot of <el-form-item>s. Then some of the fields change externally and I want to manipulate a subset of those related <el-form-item>s. I would have to write ref for every field and then I would have to come up with a way to convert a field to a ref name. In short I want to manipulate these items massively using loops and not individually, but also not all at once.

Actually I want to invoke clearValidate on certain fields. Maybe we could add a parameter to this form method like in validateField so we can do something like clearValidateField('prop')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants