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

link_to_remove does not remove elements from DOM, and thus does not support clearing out enum array #624

Open
anaulin opened this issue Jul 20, 2022 · 0 comments

Comments

@anaulin
Copy link

anaulin commented Jul 20, 2022

@nathanvda following up on #568 (comment) in a separate issue as requested.

In my case, I want to allow a user to add or remove items to a column that is an array of enum[1].

Cocoon's link_to_remove does remove the item from the form, but it leaves the array item in the DOM (just hidden), so the array doesn't get properly updated on form save (if this was an association, the _destroy attribute would update it correctly, but that doesn't work for an array field)

There is also more manual stuff that I need to do in my case, since I am letting the user pick from a drop-down of values to add, which then have to be disabled/re-enabled in the dropdown when they get added or removed. To give you an idea of how I want my form to behave, here it is with my own hand-written "remove" code:
dynamic-nested-form-enum-array


[1]: column is defined as secondary_roles public.user_role[] DEFAULT '{}'::public.user_role[] NOT NULL

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

1 participant