You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elixir version (elixir -v): Elixir 1.17.2 (compiled with Erlang/OTP 27)
Phoenix version (mix deps): 1.7.18
Phoenix LiveView version (mix deps): 1.0.1
Operating system: *
Browsers you attempted to reproduce this bug on (the more the merrier): Chrome
Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: yes
Actual behavior
In my form, I have a multi-select input accompanied by an empty hidden input, which I use to detect when no items in the select have been chosen. This allows me to empty the array field associated with that select. Here's an example of the structure:
When I edit any input in the form, this select field is marked as "used" and shows an error.
After debugging the new live_view/view.js file, I discovered that, in this loop, the hidden input and the select are treated as different fields because they have different names:
- user[addresses]+ user[addresses][]
Expected behavior
This inputs should be treated as the same input, perhaps changing this line:
I am afraid this will lead to further pitfalls down the road because anything that considers the name, including browsers features, will not consider user[addresses] to be the same as user[addresses][]. For example, FormData uses the same name for grouping, and that would not work elsewhere or any other JS library that you or we might use. So I disagree with the overall proposal.
Either handle the missing field on the server or add:
👋
Environment
Elixir 1.17.2 (compiled with Erlang/OTP 27)
1.7.18
1.0.1
Chrome
yes
Actual behavior
In my form, I have a multi-select input accompanied by an empty
hidden
input, which I use to detect when no items in the select have been chosen. This allows me to empty the array field associated with thatselect
. Here's an example of the structure:When I edit any input in the form, this
select
field is marked as "used" and shows an error.After debugging the new
live_view/view.js
file, I discovered that, in this loop, thehidden
input and theselect
are treated as different fields because they have different names:Expected behavior
This inputs should be treated as the same input, perhaps changing this line:
could work.
The text was updated successfully, but these errors were encountered: