How easy to remove the term id [id:] from the autocompelete field?

I know there's a disscussion on similar topic to this https://www.drupal.org/node/1802916

Example my autocomplete field:

term name [id:8346]

The id box is very confusing for our users. Please advice on how to remove this one.

Thanks

Comments

finaukaufusi created an issue. See original summary.

chandeepkhosa’s picture

Hi Finau,

I had the same issue as you, so went on a hunt for the part of the module that causes this behaviour.
It is in the `webform_references.term.inc` file that I need to change line 575 from
`$matches[$row['name'] . " [id:" . $row['id'] . "]"] = check_plain($row['name']);`
to
`$matches[$row['name']] = check_plain($row['name']);`

I've created this as a patch below for me, you and other users to enjoy :)

I think a great next step would be for someone to assist us in making this a checkbox option 'include Term ID in selected autocomplete field' in the main module for the world to benefit from. I will try to find some time to do this.

chandeepkhosa’s picture

Version: 7.x-1.9 » 7.x-1.x-dev
Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new711 bytes

Here's the patch

Status: Needs review » Needs work

The last submitted patch, 3: remove_term_id_from_autocomplete_field-2825264-3.patch, failed testing.

chandeepkhosa’s picture

Status: Needs work » Needs review
StatusFileSize
new501 bytes

Improved patch, this time I remembered to clone the project repository and then create the patch instead of doing so in my client project :)
Tested on my local site successfully too.

sumitmadan’s picture

Status: Needs review » Closed (won't fix)

You need to use some kind of jquery library to achieve this.

chandeepkhosa’s picture

Thanks Sumit. It turns out my patch prevents the term reference from being saved, silly me :)