The autocomplete field currently searches from the beginning of the state/province data.
I'd like to see the autocomplete fields to have the option of "first" (currently implemented) or "contains", as is found in the CCK autocomplete field.
In Italy, there are many regions such as: "Verbano-Cusio-Ossola" where the "contains" option would help the users a lot.
Comments
Comment #1
yesct commentedWhat would it take to implement this? Is it just a flag, or would code have to be written?
Andrewsuth, If you can post patch or more details about how to make the change, then maybe some people could try it out on their data, and post some feedback about whether this change would have only an upside, or if it might need more consideration.
it sounds useful to me... :)
Comment #2
andrewsuth commentedUnfortunately I don't have time to make a patch at the moment but here are the key functions for this feature:
This is taken from CCK autocomplete:
autocomplete.module, lines 861-873:In the case of this module,
contains,equalsandstarts_withare set in the widget, (line 411-429):There is a little more code but you should look through these functions in the module to get an idea of how it works.
Comment #3
ankur commentedI'm thinking since there isn't too much demand for this issue, it can be resolved as a one-off in your situation using hook_form_alter() and modifying the #autocomplete_path attribute in the form array for the province field. Another possibility is to use hook_menu_alter() to change the callback for the current #autocomplete_path and replace it with a custom function for providing the list of autocomplete options.