I'd like to have two or more names for one Term-ID in my custom taxonomy dictionary. As for now I've added a custom field and named it "Synonyms". The field can have multiple values.

How can I display values of the "Synonyms" field in the autocomplete taxonomy widget (or even a list control) together with original names of the terms (is there any way to do this?).

Real life example:

tid  |name              |synonyms                   
1    |sneakers          |gym shoes, tennis shoes    

The main name would be: sneakers but while tagging a user may also type: "tennis shoes" into autocomplete and it will link the node field (for example: "Shoes type") with sneakers (tid 1).

  • You should wrap fixed-width text with the code wrapper so it displays properly.
    – Citricguy
    Commented Sep 22, 2012 at 3:26

1 Answer 1


Two options to maybe investigate (neither are easy...):

  1. You could create a custom module using hook_field_widget_form() to define a custom widget. There are several good tutorials on hook_field_widget_form out there, here's one I found quite useful, and the Form API Reference will help too. You might also want to look at Autocomplete Deluxe as a possible base.
  2. You could create a Views table with autocomplete exposed filters, and some custom javascipt that binds a click event to each row controlling the form element, and you could use the 'Node edit' override in Ctools page manager to customise the form page and add it in. If you want one autocomplete box to filter both 'Name' and 'Synonyms', you might need some custom javascript again: maybe hide one input box and control its input with a jquery keyup event on the other box, and set the contextual filters to 'Or' in Views

Of these I'd recommend the first way - much cleaner and probably less work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.