This is actually for the 7.x Treehouseagency branch, but since it's not officially released, putting it here in 6.x.
Steps to reproduce:
Create a node with addressfield, geofield, and geocode.
Set geofield to take address field as input.
Enter in a proper address in address field and save the node. Geofield contains geo coordinates.
Edit the node and include a bogus address.
Geofield still contains old coordinates.
Ideally, a message would be displayed to the user as well.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | geocoder-malformed-address-dont-clear-field-1293794-9.patch | 1.44 KB | candelas |
Comments
Comment #1
nagiek commentedTransferring project. Love that it's on d.o now.
Comment #2
nagiek commentedOops I think this is the correct project.
Comment #3
michaelfavia commentedDesired outcome i assume is that it would wipe the geocoded result if it fails on the previous request?
Comment #4
michaelfavia commentedI checked into this for you and geocoder does indeed unset the geofield when it doesnt get a valid result from google. You can check this by setting the "other field" as body and putting in nonsense values like "tkktktktkt" youll notice previous geofield points are removed.
Unfortunately, or fortunately, google tries REALLY hard to get you a point:
http://maps.googleapis.com/maps/api/geocode/xml?address=burple!&sensor=f...
"Burple!" for example is geocoded into a city called "purple" in the phillipines.
Marking as works as intended unless you have a suggestion for improvement beyond this which im all ears for ;)
Comment #5
nagiek commentedI think so, though if it does that then we're getting into automatic data deletion. Still, the geofield input value is clearly "geocoded from another field", so if the address is no longer valid it doesn't make sense to have an outdated geofield.
In either case, I think a warning message should be displayed to the user, to let them know.
Comment #6
nagiek commentedOk thanks.
Comment #7
the666bbq commentedI'm having the same problem however : clearing or malforming the referenced addressfield (multitext/textarea) does not clear the geofield in my node. After updating is has a new revision with the previous valid marker(s).
I could clear the geofield by changing the widget from 'geocode other field' to 'long/lat' for instance and emptying the previous location there.
What is the best way to clear a location (changing widgets isn't ;-) ?
Comment #8
candelas commentedHello
I was having the same problem. Steps to reproduce:
I include a patch that will clear the geocoder field and set a message for the user.
Comment #9
candelas commentedBetter patch. It was not working well with new nodes. The problem was that when the field was equal it will return FALSE and when it had an error too.
Comment #10
pol