Closed (fixed)
Project:
Drupal core
Version:
6.10
Component:
profile.module
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 Mar 2009 at 18:23 UTC
Updated:
5 Jul 2011 at 09:21 UTC
There is no way to specify the autocomplete_path to autocomplete fields created by profile module.
The problem is that, when trying to extend this by hooks, for example:
function MYTHEME_user_register($form)
{
$form['profile']['profile_city']['#autocomplete_path'] = 'profilecity/autocomplete';
return drupal_render($form);
}The JS field autocomplete.js is not appended, because there is a IF condition in includes/form.inc verifying if autocomplete_path is empty or invalid, before calling MYTHEME_user_register.
at line: ~2027
if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path'])))
I think that a workaround for this, is create a way to user specify the autocomplete_path on a new field creation.
Comments
Comment #1
steven jones commentedUse a hook_form_alter to change forms from a module, before that code that looks for
'#autocomplete_path'runs. See http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hoo...