Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fields of the same name but different type get messed up#490

Discussion options

Environment

Vite 4.4.5
Vueform 1.9.6
Vue 3.3.4
npm

Reproduction

https://stackblitz.com/edit/github-bwjmhwik-2l1jekvb

Describe the bug

I 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
Choose Family then Brother, Sister. "0_0" will be an array of 2 items

Repro the bug:

  1. Choose Friend then John. Then choose Family then Brother. "0_0" will be a bool type when it should be an array.
  2. Choose Other. Choose Family then Brother. "0_0" is absent from the form data
  3. Choose Family then Brother. Choose Other. "0_0" is an array type with "Brother" inside but the textinput has "Brother". "0_0" should be a string
  4. Choose Other. Choose Friend. "0_0" is absent from the form data

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 context

No response

Logs

You must be logged in to vote

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

Comment options

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.

You must be logged in to vote
1 reply
@orientalperil
Comment options

Ah ok thanks for the help

Answer selected byorientalperil
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Questions
2 participants
@orientalperil@adamberecz
Converted from issue

This discussion was converted from issue #461 on October 20, 2025 10:35.


[8]ページ先頭

©2009-2025 Movatter.jp