Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If the form which the entityreference is in contains an error (for example a required field is not filled) and you select a value in the entityreference, then the value is NOT trimmed. It seems as if the alter hook is not called at all in this case?
Any ideas for the reason?
Comments
Comment #1
AnybodySet this problem to critical, because it's not possible to correctly submit the form anymore, because the whole text including "(X)" is filled into the hidden field.
Comment #2
2phaHmm, I have this problem too.
I ended up a small bit of js to get this functionality instead of using this module. https://2pha.com/blog/removing-entity-id-drupal-entity-reference-fields