Problem/Motivation

I noticed that only some address input fields were being filled out when using the browsers autofill feature. I looked at the field in question, which in my case is the Locality field. There was an extra " being printed, which resulted in an invalid autocomplete value. This is the code taken from /plugins/format/address.inc, note the extra " in the autocomplete value. Starting at line 103:

  $format['locality_block']['locality'] = array(
    '#title' => $address_format['locality_label'],
    '#required' => in_array('locality', $address_format['required_fields']),
    '#access' => in_array('locality', $address_format['used_fields']),
    '#size' => 30,
    '#maxlength' => 255,
    '#prefix' => ' ',
    '#attributes' => array(
      'class' => array('locality'),
      'autocomplete' => '"address-level2',
    ),
  );

This is actually in place in the dependent locality field as well (line 77 of the same file):

  $format['locality_block']['dependent_locality'] = array(
    '#title' => $address_format['dependent_locality_label'],
    '#required' => in_array('dependent_locality', $address_format['required_fields']),
    '#access' => in_array('dependent_locality', $address_format['used_fields']),
    '#size' => 25,
    '#maxlength' => 255,
    '#tag' => 'div',
    '#attributes' => array(
      'class' => array('dependent-locality'),
      'autocomplete' => '"address-level3',
    ),
    // Most formats place this field in its own row.
    '#suffix' => $clearfix,
  );

I just looked at the dev version and it appears to exist in there as well.

Proposed resolution

The patch attached simply removes those two quotes.

User interface changes

The autocomplete functionality will now work for these fields.

Please let me know if there is something else needed to get the patch configured correctly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skadu created an issue. See original summary.

skadu’s picture

bojanz’s picture

Status: Active » Fixed

Committed, thank you.

  • bojanz committed cde1e58 on 7.x-1.x authored by skadu
    Issue #2579129 by skadu: Autocomplete Attribute Typo
    
skadu’s picture

Wow. That was fast. Thanks bojanz.

Status: Fixed » Closed (fixed)

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

ilericiler’s picture

Addressfield_autocomplete / location_taxonomize problem. Could not get help from related module issue pages.

When addressfield_autocomplete module is active, location_taxonomize/location_taxonomize_af module can not parse location as taxonomy terms.
The alternative "addressfield_geocomplete" works normally but, it doesnt support map pinning.

The server is ready to debug and all necessary files are editable. I will be sending the password (Same for Drupal User & Folder Access) if you can help me. Thank you.

http://www.ilankar.com/_help.htm