Closed (won't fix)
Project:
Entity Reference View Widget
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Oct 2011 at 16:55 UTC
Updated:
17 Jan 2014 at 13:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jbova commentedI can confirm that this issue exists.
Comment #2
bojanz commentedSo, this patch makes the "add" checkbox behave correctly (uncheck it, and the item disappears from the sidebar).
However, there's a problem when you go the other way:
When the "add checkbox" is checked, and the entity in the sidebar, and I click "remove", the entity disappears from the sidebar, but the "add" checkbox doesn't get unchecked.
I've confirmed that when "remove" gets clicked, the "add" checkbox gets the correct #default_value (FALSE), but it seems that #value gets set somewhere along the line (and it shouldn't, because I kill the whole "add" part of form state in entityreference_view_widget_validate())
Any thoughts, Damien?
Comment #3
emilymoi commentedI believe the problem you are seeing is related to the form preserving the previous value on rebuild. You are only setting the #default_value to false--the #value overrides this. I took a very quick look through the code to see if there was a quick fix but I did not find one.
I did have a thought as I was pouring through the form code however--why is so much of the updating done on the server side? Wouldn't it be easier to maintain the list of selected items with JS and do no ajax?
In the meantime, I'm going to have to go back to my previous setup of regular old references and write some JS to filter the checkbox list.
Comment #4
bojanz commentedThis issue is no longer relevant, the 1.x branch is frozen and the 2.x branch is a complete rewrite.