I'm just trying out the multiple location functionality and can not get a second location to save. I'm only using the country, lat and long boxes, and trying to add two locations. The first saves without any problem but the second is not entered into the database.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | location_required_checking47.patch | 3.02 KB | geodaniel |
Comments
Comment #1
geodaniel commentedJust to add a little more information to this... I can add further locations if I use the 'add another location' link on the node view screen, though if at any time I edit the node through the edit screen, only the first location is saved to the node (others are discarded).
Comment #2
geodaniel commentedI've just tried this again on a fresh install, and if I only have one location available, any information I enter into the edit form is not saved. It is saved however, if I use the form on the node view screen.
Comment #3
ankur commentedI'm aware of what's causing this problem: Basically, because we have a default country selection with multiple location forms, I made the descision of having the code guess when a user meant to use a location form and when a user left it blank (i.e., when only the country field has a value filled in -- the default country value). To this end, I have the code check only against 'street', 'additional', 'province', and 'postal_code' to decide whether a location form was meant to be left blank (I was thinking it might be a usability issue if the user is forced to de-select from the default country value to the blank country value). In short, the remedy to this problem will be to modify the code to include lat/lon among the list of location fields to check for empty values before deciding whether a location was meant to be blank. The reason this criteria isn't used on the 'view' location form is that it is easier to assume the user meant to submit a single country field as a location. If you submit a patch where lat/lon is included in the list of fields checked, I'll commit it right away. Otherwise, I'm gonna need a day or two (i.e., after I get the port to 5.0 done) to write a patch.
-Ankur
Comment #4
geodaniel commentedThanks for the explanation - I'll try and get to this today
Comment #5
geodaniel commentedI didn't manage to get back to this last week, but I'm looking into trying to fix it now.
I think it's also relevant to the GeoRSS module and the way it's trying to save location information.
There seem to be issues generally with the checking of required fields. If, for example, I don't have a default country set (and I guess this is the root of the issue, as you say), and I enable location name and city as well, the location is not saved if I do not enter the country. I may wish to just use a location name and city and not have to set the country (in reality, I probably would, but if it's not a required field, I shouldn't have to).
Comment #6
geodaniel commentedHmm, I also don't think (from my point of view at least) that it's a fair assumption that if you have only entered a country then it's likely you didn't want to save it. Say, for example, that I have a blog post about Canada. I'd just want to associate that with Canada and not something more specific. I guess we're working to different use cases - I suspect you're working more with addresses (formally structured data) whereas I'm working with location data that could feasibly include any combination of fields. We need to try and cover both use cases if possible though, to keep the module flexible.
Comment #7
geodaniel commentedOk, here's a patch (against 4.7 right now) that should have better results.
First location can consist of a just a country (including default location), just the coordinates, or any combination of those. Also, if any other fields are set then it should be saved regardless. For subsequent locations, the same logic goes, unless the country is the only field filled in AND it is the default country, when we ignore it presuming that they haven't changed anything there. So, for those extra locations you could choose just the country, as long as it's not the default country.
There could potentially be an issue if a user only wants to select country names - they would only be able to choose the default country as the first one in the list. I can't think of any way around that though.
Ankur, does this logic sound good? Testers appreciated... :)
Comment #8
geodaniel commentedI have just tested the same patch against 5.x as well, and it applied cleanly and works as expected (it's also allowing me now to add lat/long coordinates to nodes from other modules).
Comment #9
ankur commentedCommitted to DRUPAL-5 and DRUPAL4-7
Comment #10
(not verified) commented