Prelude: We talking about two different theme in one issue: #968112: Allow addressfield to be optional
The general behavior of any field in the current Field API is the next: All fields may be flagged as non required, and if the user leaves it empty, then the API does not stores any data into the database, and not displays the label of the field on the node view page.
The Addressfield module uses the site_default_country system variable to set a default value to the Country field in all cases. This causes an unwanted behavior if the Addressfield is on optional field and the user does not want to set the Address. The module stores the default country to the database, and displays it on the node edit form. This is a major bug, because if the user left the Address field blank, then we do not store and display anything.
One way exists to the solution, if we do not use the site_default_country by default, just simple add a - None - value, az a possible choice. If the default is set to the - None -, then the operation must be the same, as any other field. I attached a patch, to the another issue - http://drupal.org/node/968112#comment-5611592 -, which is a half-solution, because not contains a validation. The current state, if the user fill any field, but leaves the Country empty, then we simply save the node without this address, and we lost the user entered (street, postal code, etc) data. I working on the validation and a full solution in these days.
Comments
Comment #1
klonosI've closed #1413158: Prevent Address Field from storing empty data in database as a duplicate of this one (but I really liked its title better).
As I've said in #968112: Allow addressfield to be optional, I agree that this is an existing problem and that there should be a solution - I simply do not agree with the way you are trying to solve it for one and only reason: I am afraid that it will break the current functionality for the rest of us that don't want to leave the field optional + hide the default country (so it can be auto-entered in every node created). If you simply make sure that you don't break this functionality, I'm sure that nobody would object. Can you do that?
Leaving the other issue was a nobble thing to do, but you honestly didn't have to. You've already done a lot of work and provided patches there and it would be a waste. So, please consider closing this one and continue working back to that issue.
As I also explain in #968112-56: Allow addressfield to be optional, our hide-country-from-display issue is to be solved here: #1316788: Do not display country in address block if only one country option is available, so we are the ones leaving the other issue (as we should).
Comment #2
zoltán balogh commentedIt will be continued in the original issue (mentioned as Prelude in this issue).
Comment #3
klonosThanx Zoltán and sorry for putting you through all this trouble, but if we keep the issue queue as clean as we can (with as less duplicates as possible), then we give more time to the maintainers to look at our code and thus have more chances of things getting in ;)