Closed (fixed)
Project:
Location
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 May 2013 at 21:37 UTC
Updated:
18 Jan 2020 at 00:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
delvalle commentedSame problem here...
Comment #2
delvalle commentedI guess there are many users experiencing this same problem, since I found two more issues regarding this: http://drupal.org/node/1419448 and http://drupal.org/node/1430294. Both are quite old (2012) but still not solved.
Anyone could help, please?
Comment #3
edubuc commentedHi,
Right now I have the same problem when I use Country/Province location field (with dropdown display) on a profile2 entity type.
So on custom node type :
On a profile2 (entity type) :
Comment #4
vashel commentedI'm running into the same issue with the latest version of Location (7.x-3.0-rc4). I also have profile2 installed, however, I'm running into this problem with the state/province list not updating on the normal user profile form (enabled in Configuration -> Account Settings -> Location Settings). The auto-complete field updates as it should.
Any idea how to fix this? Patches or workarounds?
Comment #5
vashel commentedStill an issue in RC5.
Comment #6
fugazi commentedsame problem as in #3
profile2
dropdown does not work the province list,
autocomplete ok.
Node Type
dropdown ok,
autocomplete ok.
tested, 7.x-3.x-dev and 7.x-3.1 both are not working
Comment #7
jschoder commentedI had the same problem in my local installation. Didn't have the time to support a patch yet. Here is the solution if you want to duplicate it:
https://drupal.org/node/2122095
Comment #8
fugazi commented#7 did you solve it? How could you solve it for your case?
Comment #9
podarokComment #10
Mnilionic commentedOn custom entities dropdown not updating too
Comment #11
djdevinHere's a patch to fix it hopefully wherever it is used. Tested with node forms,field configuration, and profile2.
The challenge was setting the value of the province field while the triggering element is the country field. So you have to go up and down the form tree.
Instead of relying on this super old arg(x) logic in the ajax call we can use drupal_array_get_nested_value() and the element's #array_parents.
Comment #12
djdevinComment #13
mark.cameron commentedThe patch works and displays the correct states, but when I try to create a user with a state I get an error saying:
"An illegal choice has been detected. Please contact the site administrator."
I can only create a new user if I don't select a state, Might be linked to the patch?
Comment #14
djdevinTry selecting a different country, then a state. I think it has to do with the form rebuild. I'm sure the patch can be fixed up. It's much more graceful solution.
Comment #15
mark.cameron commentedNo that doesn't work either, as long as I set a state it won't create the user.
It sends me back to the form, the country is selected, but the states list isn't populated, if I change to another country and select a different state, and save, same thing happens.
Comment #16
djdevinHow do you have your location set up?
Comment #17
jphelan commentedThis patch did not fix it for me. Using the location field on a crm entity as part of the crm_core module.
Comment #18
DrCord commentedWhen will this patch be committed?
Comment #19
DrCord commentedComment #20
DrCord commentedThis issue still persists on the latest dev version and the patch offered is no longer applicable.
Comment #21
djdevinCurrent version is 7.x-3.x
Comment #24
djdevinRerolled.
Comment #25
DrCord commentedThen why do I have 7.x-5.x-dev as the latest version, downloaded from drupal.org via drush? This problem still persists in that version...
The very latest dev version that apparently came out last night does not seem to have this problem anymore...yay!
Comment #26
djdevinI think it's because 5.x is technically newer than 3.x however it was abandoned long ago.
You won't see the issue unless you are using a location field outside of the root of a form or in the 'locations' form element. So, basically anything that isn't stock Drupal/Location, like field collection or profile2.
Comment #27
DrCord commentedIf you have an abandoned branch that is easily installable, that is REALLY messed up, you need to remove it. Drupal's auto update informed me of an update to this branch that needed to be installed as it was newer... drush happily moved me to the abandoned branch...
Now I am on a abandoned branch and moving back is going to be a problem...please advise.
Comment #28
podarok7.x-4.x and 7.x-5.x are abandoned versions. Don't use them. The working and actively maintained branch is 7.x-3.x
This version marked as supported instead of others, so if You have got an abandoned via drush for some unknown reason - this is a bug of a drush.
Sorry for making You uncomfortable with using location module. Abandoned branches are the tails from previous maintainers and will be removed asap
Please, do update tjis issue if You want something updated/changed...
Comment #29
djdevinHey this is actually still "needs review" (#24)
It fixes an issue when Location fields are used within nested field locations (i.e., not at the root of $form).
Currently reproducible in 3.x with field collection and profile2.
Comment #30
podarok#24 looks not so trivial. Good to see test cases here.
Needs tests.
Comment #31
djdevinHm it's tricky because it's AJAX, I'm not sure we can test it thoroughly with Simpletest.
To be fair there also aren't any existing tests for the Location AJAX functionality so this would be a new test case anyway.
I'll try it without JS off and maybe submitting the form with only a country selected will give me something to work with.
Comment #32
djdevinHere's an example of it not working, just a simple "location_element" field on a custom form.
Selecting a country has no effect.
After patching with #24, it works as expected.
I tried to write some tests but I can't find a way to reproduce it without AJAX. I might be able to fake a POST and check responses.
Comment #33
jay.lee.bio commentedDjdevin, #24 works flawlessly! Thank you so much!
Comment #36
podarokComment #37
deminyWe noticed this issue with our Drupal installation (Drupal 7.37, Location 7.x-3.6, Commerce 7.x-1.11, with multilingual support) under certain situation:
* We have a few languages enabled, including English and Chinese. We did not see any related issues with English version.
* When editing Commerce products with default admin pages shipped by Commerce, everything is fine even under Chinese language.
* Under the customized product edit page developed by us, the issue happened when using Chinese language, as mentioned in the title of this thread: "States/Provinces dropdown not updating with country change".
Applying patch #24 fixed the issue. I have just applied the patch and not quite sure if there could be any side-effects, but will report in case I see any.
Thanks for the patch, @djdevin.
Comment #38
djdevinRerolled.
Comment #39
Miles Ulrich commented#38 solved an issue I was seeing with a Location field inside of a Profile2 profile. Thanks!
Comment #40
fyberoptik commentedThanks djdevin!!! #38 worked perfectly.
Comment #41
gaurav.goyal commentedPatch #38 works for me too.
Location module version: 7.x-3.7
Comment #42
blueminds commented#38 tested, works as expected
Comment #43
Devestaaron commentedWhile #38 fixed the problem, it caused a new one. Now I'm getting the following error whenever a user location changes state/province:
Comment #44
rudiedirkx commentedPatch in #38 gives me these:
because I have all province fields disabled:
Comment #45
rudiedirkx commentedComment #46
rudiedirkx commentedNew patch fixes #44, rolled against dev.
Comment #47
deminyManually reviewed #46 and looked good. Thanks @rudiedirkx
Comment #48
podarokThanks, merged.
Comment #51
eit2103 commentedThanks a lot, helped me too! Why wont they just include this fix in the module.