Hi,
I'm trying to add an autocomplete form field via form API.
Usually Entity Reference Autocomplete works quite well.
But it does not work for CRM core contacts because it is trying to filter by label. Since contacts don't declare a label it does not work.
Usually the label is a column on the entity, but since we usually filter by contact name this is not possible since the name is a field stored in a different table.
So my first idea was to create a label field that is always updated on entity save to copy the name information to that field.
Then the entity could be filtered by label ( name ).
What do you think about this? Any other ideas for a better approach? Maybe there is even a possibility to have an autocomplete reference field via form api that i didn't see.
Comments
Comment #2
bechtold CreditAttribution: bechtold at Bright Solutions GmbH commentedThis module uses the same approach to filter by label: Entity Autocomplete
Comment #3
bechtold CreditAttribution: bechtold at Bright Solutions GmbH commentedI change the title because an integration with this specific module is not needed, if there is a different solution to my initial problem.
Comment #4
bechtold CreditAttribution: bechtold at Bright Solutions GmbH commentedAwesome, I just checked out the dev branch and it seems that you already implemented this.
My first test with Entity Reference Autocomplete seems to work, i continue testing.
Comment #5
RoSk0Hi,
Yes, we switched to this approach to have more flawless integration with entityreference and other modules.
Comment #6
RoSk0Can you please confirm that new approach is working for you?
Comment #7
RoSk0Comment #8
mikez93 CreditAttribution: mikez93 commentedI just upgraded from 7.x-0.980 to 7.x-1.0 and lost most (but not all) autocomplete functionality. Sounds like I need to install the Entity Reference Autocomplete module? True?
https://www.drupal.org/project/entityreference_autocomplete
Comment #9
mikez93 CreditAttribution: mikez93 commentedLearning more here. It's not the autocomplete functionality that I lost but it seems the install process failed to populate the new "Name" column that is added to the crm_core_contact table at install. I've created a new issue for this:
https://www.drupal.org/node/2886899
Comment #10
grahlClosing outdated issue, please reopen if still relevant.