Would be great to be able to restrict allowed values. Ability to select only certain states as options, the way that Views allows for exposed filters; or at least to set a default state (/province). So, something like hierarchical checkboxes (Country/State) on config page, to limit the address options for localized use.

I'd welcome even a patch for that.

Comments

greta_drupal’s picture

Or read-only & hidden values for country and state.

greta_drupal’s picture

Status: Active » Closed (works as designed)

Oops. My bad. You actually can set default state. (Lost track of which content type I had modified.)

This module is a lifesaver! Wasted a lot of time on a different address / geocoding module.

nithinkolekar’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (works as designed) » Active

@greta_drupal

are you sure it is possible to set default state/province?

I don't find it in field settings with latest dev version. could you please share info/screenshot?

bojanz’s picture

Status: Active » Closed (works as designed)

Please open new issues instead of reopening old ones.

The ability to set the default state (or any other address component other than the country) was removed from Addressfield 1.0 because it was exposing an unfixable Drupal core issue around the default value handling. See #2392863: Remove the default values instance setting, introduce a default country instance setting.

You can implement hook_addressfield_default_values_alter() as documented in addressfield.api.php instead.