0

I have implemented Autocomplete Search functionality. Autocomplete suggestion will be available based on characters typed in textbox. When user selects a suggestion then user will be navigated to the page.

Now I want to know that if any website contain same name then how to distinguish between these two.

Example - Website contain 4 Names of Person:- Sandy, Siren, Anita, Sandy. When user type S in text field then 3 suggestion appear i.e - Sandy,Siren,Sandy.

How to distinguish between two "Sandy" using Drupal default Autocomplete feature.

1 Answer 1

1

Few Possibilities:

  • You can add a content-type name along with the node title when autocomplete shows the result to describe the user in which relation it goes. For e.g., "Sandy -- Content Type Name"

  • You can add a Nid along with the node title when autocomplete shows the result to describe the user in which relation it goes. For e.g., "Sandy -- Nid" Nid I don't think is a good idea. But you can also set some relative name while getting result for user to know which "Sandy" should be chosen.

Hope it will take you on the right path.

1
  • I am able to implement both this things. Your second suggestion will expose the NID to end user which means that there can be security concern. First suggestion will be a problem if similar name contained in same content type.Only nid will be able to differentiate between two similar nodes.Are there any event to capture the selected autocomplete suggestions in Drupal so that I can pass hidden NID inside the autocomplete suggestion. Dec 5, 2013 at 18:50

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.