0

I'm writing a custom text field and widget module with ajax autocomplete from scratch. I want the lookup to work on one column, but I want another column's value (the looked-up item's id) to be saved as the field value in the node.

So, for example, user types for example Sams, they accept suggestion Samsung, but Drupal save its database identifier, say 145.

Conversely, when opening the node for editing, the saved value of 145 should be again looked up, converted and displayed as Samsung.

What is the key to get it working the Drupal way?

0

Use the Entity and Entity Reference modules to create the link between the two items, using this method means your selections will be available to other modules such as Views, Rules, etc.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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