Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I am trying to use the widget of autocomplete for allowed values list of this module for suggesting possible values while typing basing on allowed values list. But It does not suggest any possible values from allowed values list even those that have ever used in other nodes which share the same field.
Could this module be modified to show all possible values from allowed values list no matter they ever or never used in other nodes.
Thanks
Nguyen Quoc Viet
Comment | File | Size | Author |
---|---|---|---|
#2 | autocomplete_widgets-405628-2.patch | 3.8 KB | markus_petrux |
Comments
Comment #1
markus_petrux CreditAttribution: markus_petrux commentedHi,
You can use the "Autocomplete for allowed values list" widget for any field of type Text or Number with a list of allowed values defined in the field settings. In this case, the autocomplete widget will use the allowed values list to find candidates.
On the other hand, you can use the "Autocomplete for existing field data" widget for any field of type Text. In this case, the autocomplete widget will use existing data for that field in the database to find candidates.
It seems that you're trying to use the "Autocomplete for allowed values list" widget, and maybe it doesn't work for you the way it is supposed to work. In this case, could you please export your content type definition and attach it here?
Comment #2
markus_petrux CreditAttribution: markus_petrux commentedHi,
I believe I've found the problem. It may happen when the field is shared between several content types, and it was first created using a different widget. To solve this, I'm adding the content type name to the autocomplete path, so that we can load the information of the correct widget to compute the candidates. Also, I'm checking the type of the argument $keys used in certain functions internally.
Please, let me know if the attached patch fixes your issue. Thanks.
For the moment, the attached patch seems to work better in my test environment, so I commit that, but I would wait to release a new package for confirmation on whether it also solves your issue.
Comment #3
markus_petrux CreditAttribution: markus_petrux commentedIt's been more than a week with no feedback, so I assume the patch works. I'll wait a few more days before packing a new release, however, just in case something else arises.
Comment #4
markus_petrux CreditAttribution: markus_petrux commentedFeel free to re-open if this needs attention. Thanks for reporting.