If a particular geocoder field is used on multiple content types, the autocomplete functionality is not guaranteed to be correct when trying to populate additional fields (address, city, zip, etc.)
Scenario:
Have two content types named Business and Organization, each with a geocoder field named Address. When creating a Business node, all functionality works as expected. But, on Organization it does not.
Problem:
Once an address is chosen from the autocomplete field, a POST is made to the server for additional information. On the return, the various fields are given, with value, type, and a few other fields. However, the type attribute is not populated, and set to null.
Reason:
When getting the fields to create the JSON return, no content type is specified. Therefore, it returns the first instance of the field, which may not be the correct instance.
Fix:
Specify the content type in content_fields() in the openlayers_geocoder_coordinates function. In order this to work, the content type will need to be either looked up, or sent with the POST. I've created a patch in which the content type is retrieved from the form, and then submitted with the POST, and then used with the function.
Let me know what you think, and if it works for you.
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | openlayers_geocoder-917250.patch | 1.91 KB | mikesir87 |
Comments
Comment #1
ademarco commentedCould you attach the patch you mentioned?
Comment #2
mikesir87 commentedI'm sorry about that. I guess it didn't attach correctly. I had to recreate it, and haven't been able to test it (since I made the original one at work), but I believe it is correct.
Comment #3
ademarco commentedThanks a lot! Committed: http://drupal.org/cvs?commit=426396