After setting up a postal content field to allow for Unlimited values, you can create a new node and add as many address fields as you like by clicking the 'Add another item' button.
This works great but there is a downside. If I decide I only need 3 addresses but I have added 4 fields already, there is no way to remove the 4th field. Also, after saving and then editing the content again, if I had 3 addresses and wanted to save only 2, the 3rd field remains since there is no way to deselect the country dropdown. So 2 addresses would be saved fully and the 3rd would still have the country value since the country field is required.
On a side note, the module is looking great so far. I really am excited to see where it is headed!
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | Screenshot.png | 35.15 KB | maxchock |
| #2 | address_edit_screen.png | 32.22 KB | jmcsweet |
| #2 | address_results.png | 7.33 KB | jmcsweet |
Comments
Comment #1
jmcsweet commentedI've got the exact same problem. Because the Country field is required, it automatically adds the default country again if you're allowed to add unlimited addresses to your content type.
Interestingly no matter how many empty address fields are added to the edit screen, the country code is still only displayed twice.
You can see the attachments to get a better idea of what's going on.
Comment #2
jmcsweet commentedOk, lets see if my attachments work this time.
Comment #3
jcarlson34 commentedThose screen shots show visually exactly what I have been experiencing. A picture is worth a thousand words indeed!
Comment #4
jcarlson34 commentedPerhaps we could add a delete or remove button to fix the issue?
Comment #5
damien tournoud commentedYou can now remove an address by setting its country to
- None -. Not optimal, I agree, but a possible workaround for now.Comment #6
jcarlson34 commentedMany thanks Damien. That
-None -definitely helps workaround the problem.Comment #7
afeijoA delete link would be more user friendly, as a click is easier than to have to wipe the content of all address fields?
I'll try to add that link
Comment #8
maxchock commentedI got a warning if select the Country to
NoneWarning: end() [function.end]: Passed variable is not an array or object in file_managed_file_validate() (line 536 of /home/buddyjoy/public_html/modules/file/file.module).
Comment #9
BenjamiB commentedAny update on this? the field works but its would be very nice to have additional address showing up only when the first is filled in because the field is quite big...
Comment #10
BenjamiB commentedFor those interested, I'm using this not very nice but hopefully temporary workaround in order not to populate empty address field :
$delta = $form['field_address']['und']['#max_delta'];
$form['field_address']['und'][$delta]['#address']['country']=NULL;
Comment #11
michaelfavia commentedSubscribe.
Comment #12
wabs commentedI have the same problem - because the number of addresses is not restricted, on every node save an additional address is generated (with just the default country and nothing else). I don't see the "-None-" option, otherwise it would have been my default country.
@BenjamiB - Thanks for the patch. Where exactly in the module do you insert it?
Comment #13
michaelfavia commentedLets handle the remove button here and the "non-empty fields patch" #1263316: Configurable non-empty value conditions should take care of the extra addresses getting saved.
Comment #14
dgastudio commentedpatch not applicable to the latest dev.
Comment #15
RobKoberg commentedIs this module maintained? Why not simply set the field to default to '- None -'?
Here is another hack (javascript, though). However, even if you set the field to *not* be required, the first Country select does not even have an option to select None...:
Comment #16
TimelessDomain commentedI agree with #13. #1263316: Configurable non-empty value conditions applying this patch automatically removed "empty" address fields upon re-saving the entity.
So now to delete addresses you should just have to clear out the fields then save.
Comment #17
TimelessDomain commentedComment #18
bendiy commentedShouldn't this be a core Fields API issue?
Clearing all the fields and setting the country to "- None -" does not suffice. Normal users do not understand this work around.
Comment #19
bendiy commentedI guess it is: #1038316: Allow for deletion of a single value of a multiple value field
Comment #20
joachim commentedMarked #984788: Add "Remove" button to clear out values in a multi-value address field widget as a duplicate. Definitely a bug report.
Comment #21
rszrama commentedI'm not sure I get joachim's comment / recategorization; the link is to this issue.
Since this does appear to be a core concern (see comment #19) and a patch in another issue will also resolve underlying "problem" (see comment #13), I'm going to make this a UI feature request as the kernel that remains is a request to make it easy to clear out an address field value so it is "deleted" on save.
Comment #22
deanflory commentedrszrama, do you think you'll be able to get to this soon? Just wondering if I need to consider other options since I believe this is a pretty big concession going from Location Field to Address Field. If a field allows "Add Another", then having an "X" or delete link is pretty much required, any other finagling a user has to do to remove it is simply not friendly at all. Not what I'd expect from taking on a "field" module.
I ask because this is a 2.5 year old issue without any movement, only additional separate duplicate issues and additional requests for the same basic functionality.
Comment #23
kkalaskar commentedSame issue i faced while adding address field for over come this i installed module Multiple Fields Remove Button . Its work for me.
Comment #24
rahul_sankrit commentedSame issue i faced for image field and worked for me.
This is for single value deletion from multiple value fields