I needed address field in site so I used this module and wanted to set default values as most visitors will have some common values, like city and zip.

However, when I edited User profile, I found that when I changed some other field and saved (e.g. user name) upon saving, I had another address consisting only of city and zip which were there by default. So I have to:

  1. either remove default values, forcing users to type (bad for UX)
  2. or to have them erase which is even worse

Comments

hazah’s picture

Same here. I hacked the module, as it was unexceptable, but would love to see this fixed here. It makes no sense to force to undo the defaults just to ensure that another address is not created. Worse still, there is no method to get rid of an existing address other than makeing it "empty". There should be a button to do that.

Short term solution (provides a "- None -" option in the field's "Available Countries" setting & uses it instead of the site's default if the setting had been set in that list:

  1. In function _addressfield_country_options_list, change the initial assignment to $countries to be $countries = array('' => '- None -') + country_get_list().
  2. In function addressfield_default_values:
    • Change the initial assignment to $default_country to be $default_country = ''.
    • The original assignment happens next unless the "- None -" is in the $available_countries variable.
hazah’s picture

Any development on this?

les lim’s picture

Priority: Critical » Major
Status: Active » Closed (duplicate)

There's a patch in the queue for configuring which parts of the address must be entered in order for an address to be saved, which would resolve this issue:

#1263316: Configurable non-empty value conditions

Marking this as duplicate.