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

Form with dynamic/custom fields inside loop #4861

Closed
5 tasks done
dennismetz opened this issue Sep 14, 2024 · 2 comments
Closed
5 tasks done

Form with dynamic/custom fields inside loop #4861

dennismetz opened this issue Sep 14, 2024 · 2 comments

Comments

@dennismetz
Copy link

What happened?

I have a form that I would like to send. Within this form, I generate new fields depending on the number of data records. If I now edit one of these fields, all data records are edited and changed.
The validation does not work either and only the last field is validated.
However, only the visible fields are changed. The ID, for example, remains the same as long as it is not displayed in any input.

If I now omit the “form” around the fields, everything works.

Github Link to Repo: https://github.com/dennismetz/veevalidate-bug

Reproduction steps

  1. Checkout the project and run it (localhost port 3333)
  2. Wait until the data has been loaded
  3. Change an input field - no matter which one
  4. All fields are changed

grafik
grafik

Version

Vue.js 3.x and vee-validate 4.x

What browsers are you seeing the problem on?

  • Firefox
  • Chrome
  • Safari
  • Microsoft Edge

Relevant log output

-

Demo link

https://codesandbox.io/p/github/dennismetz/veevalidate-bug/

Code of Conduct

@dennismetz dennismetz changed the title Form with dynamic/custom Fields and loop Form with dynamic/custom Fields inside loop Sep 16, 2024
@dennismetz dennismetz changed the title Form with dynamic/custom Fields inside loop Form with dynamic/custom fields inside loop Sep 16, 2024
@logaretm
Copy link
Owner

logaretm commented Oct 19, 2024

The field has no idea it is a part of a loop. You should ensure that each field name is unique either by using indexes as part of the name. Alternatively consider using Field Arrays.

@logaretm logaretm closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2024
@dennismetz
Copy link
Author

Hi @logaretm, unfortunately, I have to ask again.

I have now tested a few things, but have not come to any conclusions.
Even if I add an ID to the “name” attribute in the input, it doesn't work.
With field arrays, I have to use an initial-values in the form, but I can't do that because the data is loaded later. I do know which fields will arrive, but these fields are not displayed.

Could you please help me here, I'm getting desperate about the whole thing

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