The state dropdown doesn't hold it's value when you preview or go back to re-edit a node.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ankur’s picture

Assigned: Unassigned » ankur
ankur’s picture

Fixed it with a patch: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/location/loca...

In the future: Maybe I should upload the patch here first and then commit.

-Ankur

joshk’s picture

Not fixed completely. The error still occurs if an admin has set up a content-type which allows state/province, but does not allow for country. This is because with the following login in location_api2form, if the country is not set, the province field will remain unset in $translated:

if ($key == 'province') {
  if (strlen($value) && isset($location['country']) && strlen($location['country']) && $location['province'] != 'xx' && $location['country'] != 'xx') {
    $translated['province'] = $location['country'] .'-'. $value;
  }
}
else {
   $translated[$key] = $value;
}

A lot of other functionality seems to be missing when the country field is disabled as well (e.g. map links). Maybe it should not be optional?

ankur’s picture

Fixed for real this time! (by the [gasp] multi-taskin patch at http://drupal.org/node/19604 )

I'm trying to get the module to detect when a person has selected a state from the province drop down but not the appropriate country.

The "value" attribute for the province HTML select options go by us-CA for California, us-WA for Washington state and so on. The idea is that someone can later write a JavaScript that narrows down the province selection to the appropriate states when a country is selected. However, currently, if someone selects a state but forgets to select a country, why not complete the task for them?

-Ankur

Anonymous’s picture

seutje’s picture

Status: Closed (fixed) » Active

Think I just hit the same problem, not using CCK, just 6.x-3.x-dev Location. Default country is set to "Belgium" and is omitted from the node/add form, default state/province is set to "Antwerpen", but isn't omitted from the node/add form, now when I first submit a node, it'll do things as expected, but when I edit the node, the state/province field will say "VAN"

this does not happen when previewing, only when editing

YesCT’s picture

seutje, please look through the issue queue for other issues involving "defaults" and see if any of them might be related to what you are seeing...

DamienMcKenna’s picture

Am seeing this myself in v6.x-3.1.

casmbu’s picture

I am seeing this issue in the v6.x-3.x-dev.

smk-ka’s picture

Status: Active » Needs work
FileSize
811 bytes

With the province display option set to "Display full province name" and no default value for province specified, the hack as in the attached patch was required to make the province value stick during node preview. Depending on your specific settings for the province field it may or may not work, hence "needs work".

smk-ka’s picture

Status: Needs work » Needs review
FileSize
1018 bytes

Revised patch which acts on whether a node preview is in progress or not.

casmbu’s picture

#10 worked #11 did not

podarok’s picture

Status: Needs review » Active

bot recall

podarok’s picture

Status: Active » Needs review

bot

Status: Needs review » Needs work

The last submitted patch, location-province-19465.patch, failed testing.

legolasbo’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

Closing old D6 issues as D6 is end of life