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

When using FormKit type radio in a loop, the state is not displayed properly when clicking another in the list. #1029

Closed
fdverwoerd opened this issue Nov 9, 2023 · 4 comments
Labels
🐛 bug-report Bug is reported, but not verified by team ⛑ Needs triage The issue has not yet been examined by the FormKit team.

Comments

@fdverwoerd
Copy link

fdverwoerd commented Nov 9, 2023

Reproduction

https://formkit.link/bc0d697632a3ecd0c36063530a702759

Describe the bug

So here is a dynamicly list group. But when clicking add item in list (e.g.) 'geslacht|gender' the model is updated though, but the first item in the list looses the 'selected' value? Why is that?

Environment

• OS: MacOS sonoma
• Browser firefox
• Version 119

@fdverwoerd fdverwoerd added ⛑ Needs triage The issue has not yet been examined by the FormKit team. 🐛 bug-report Bug is reported, but not verified by team labels Nov 9, 2023
@fdverwoerd fdverwoerd changed the title When using FormKit type radio in a loop, the state is displayed properly when clicking another in the list. When using FormKit type radio in a loop, the state is not displayed properly when clicking another in the list. Nov 9, 2023
@fenilli
Copy link
Contributor

fenilli commented Nov 9, 2023

That is correct, radio's with the same name are linked by html specs. you can use this simple plugin to add an alternative name to your radios: https://formkit.link/a7dd505546e9c3d057a99de968577ea8

But I guess they should be done automatically because they are in a dynamic list, maybe its because they are also inside a group @justin-schroeder?

@fdverwoerd
Copy link
Author

It seems to be working if I make the name prop unique, but in my case I was expecting that because it is in a group it is 'scoped'.

:name="'gender_'+index"

@justin-schroeder
Copy link
Member

Yeah if this was a dynamic list this would be done for you automatically. In a static list though it is expected that you name them uniquely. (notice the list is missing "dynamic"):

image

Best of luck 👍

@fdverwoerd
Copy link
Author

Thank you very much! I also added :index="index" to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug-report Bug is reported, but not verified by team ⛑ Needs triage The issue has not yet been examined by the FormKit team.
Projects
None yet
Development

No branches or pull requests

3 participants