Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork107
Fields of the same name but different type get messed up#490
-
EnvironmentVite 4.4.5 Reproductionhttps://stackblitz.com/edit/github-bwjmhwik-2l1jekvb Describe the bugI have a form that dynamically adds questions based on given answers. The first question field has the name "0". Some answers to that question will add a new question with the name "0_0". Sometimes the type of "0_0" will be a string and sometimes an array. When the type changes Vueform makes a mistake and puts the wrong value in or just completely removes the field. Choose Friend then John. "0_0" will be a string Repro the bug:
These scenarios demonstrate some strange unexpected behavior. It looks like when the field type changes vueform is not detecting the right thing to do and tries to apply the value regardless of type. Additional contextNo response Logs |
BetaWas this translation helpful?Give feedback.
All reactions
The issue is thatformData is refreshed onlyafter the input type has changes which means it might receive an incorrect default value type. A solution is to make the default value a computed which makes it always aligns with the selected type.Here's one way of fixing it.
This isn't really an issue with Vueform so I'm moving this to discussions.
Replies: 1 comment 1 reply
-
The issue is that This isn't really an issue with Vueform so I'm moving this to discussions. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Ah ok thanks for the help |
BetaWas this translation helpful?Give feedback.
All reactions
This discussion was converted from issue #461 on October 20, 2025 10:35.