Closed (fixed)
Project:
Address Field
Version:
7.x-1.0-beta2
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Jan 2012 at 23:05 UTC
Updated:
1 Jun 2012 at 18:00 UTC
I'm working on a site for a Canadian company. They don't do any business in the US, so their form should only have Canadian fields. I set Available Countries to have only Canada selected, and the default is set to Canada as well (the only option). When I view the form containing the field, I see Canada selected (we don't really even want that select list since there's only one anyway) but the form still shows US states and the zip code field instead of the Canadian equivalents.
Comments
Comment #1
seanrI actually found that once I added the field to my entity and then went back to edit it, the values weren't bing saved. I had to export it to a feature and manually edit the exported code and then revert the feature in order to get the field's settings updated correctly. So there's some kind of issue with storing field settings on an update.
Comment #2
helior commentedSeanr, you'll be pleased to know that the dev version of Address Field contains a new format plugin for removing the Country field if it's the only option! I think the issue with the US fields displaying is because the field instance settings doesn't have Canada as the default value.
1) In the field settings, select Canada as the only option. (Don't use the "Hide the country when only one is available " formatter yet!)
2) Go back to the field settings, you might notice that the Canada is the only option, but US fields are displaying. Click "Save Settings", and the settings page will basically refresh (Address Field validation requests the form to be rebuilt, and that's why you're experiencing what you described in #1)
3) Now that the form is rebuilt, you should see Canada specific fields (Province, Postal Code). Go ahead and save the defaults again and you should be good to go!
You'll still experience the edit forms rebuild on validation for existing entities that have a different Country saved (That's intended behavior). But once all your content is squared away with the correct country saved, you can go ahead and use the "Hide the country when only one is available" option.