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

steven jones’s picture

Category: bug » support
Status: Active » Fixed

Use 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...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.