location already supports a default country. it'd be nice to allow support for a default state/province, too. nearly all of the locations my site has to deal with are going to be in a single state. if i just disable state/province collection, then the map links don't work. and, it's possible some nodes might need locations outside the primary state. i'd rather collect and store the state/province, but not force everyone to deal with the huge drop-down menu, since 99% of the time, they wouldn't need to change it from the default.
i'm brand new to drupal, module APIs, etc, so my initial attempts to hack this into a test 4.6 installation were unsuccessful. i managed to change location_settings() to ask for and store the default, like it does for country, but in the other places where it's collecting location data, i couldn't get this stored value to be used as a prefilled value anywhere. however, it seems like someone who actually knows they're doing could do this very easily. :) is there any good reason not to do this? i'd be happy to share my initial efforts (though i doubt they're of any value to anyone). alternatively, if someone was patient and gracious enough to help me get up to speed with the location APIs, i could probably finish the task myself. let me know. thanks!!
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | location_default_province-45593_5.patch | 1.86 KB | mrtoner |
Comments
Comment #1
catchMarking as duplicate of http://drupal.org/node/217512
Comment #2
bdragon commentedUnduplicatifying
Comment #3
yesct commentedI think I saw an other issue on default states, cities, etc, but I cant remember which one, I'll tag this for now.
Comment #4
mrtoner commentedWould like to see this handled. I understand how to get the field to be hidden (copying from the 'country' case):
location.module
but I'm missing how to get the default value to be entered. If someone will guide me in this, I can post a patch.
Comment #5
mrtoner commentedWell, it turns out my difficulty was caused not by my ignorance, but by a bug in how default value settings are handled. Here's the patch to implement the Force Default setting for the Province field.
Comment #6
mrtoner commentedMarking this as a bug, since currently Force Default doesn't act any differently than Allow or Require regarding the default value.
Comment #7
yesct commentedmrtoner, thanks for your many patches!
Comment #8
yesct commentedPatch needs to be rerolled against the latest release. Please set this back to needs review when a new patch is posted. Or set it back to active if the problem can be confirmed in the new release. If no one is interested in this, we will close it in a couple weeks. If interest picks up again, just set the status back to active and post information about your use case.
Comment #9
ankur commentedWe're done with new features in the 6.x-3.x/7.x-3.x branches. When we get a cleaned up fields implementation in 7.x-5.x, we may look into supporting something like this.
Comment #10
dwwThere's still no support for this, so it doesn't "work as designed". If you want to bump the version, cool, but please don't close feature requests that a) are legitimate/good ideas and b) don't exist yet.
Thanks,
-Derek
Comment #11
ankur commented@dww
Whoa. I didn't realize anyone was attached to this issue since it'd been dormant for 18 months. To explain myself, this module has a pretty unwieldy issue queue with a bunch of out-of-date tickets. While this particular ticket is not as dated as some of the other open tickets, my present goal is to make the queue more managable (and thus more inviting to other developers that might be interested in co-maintaining this module), which is why I've been trying to close as many issues as possible (particularly the ones that look like they won't see any follow up).
I hope I didn't offend you by closing your ticket and hope you stick around to help. I don't mind leaving this ticket open for a resolution if someone is committed to it. By the way, you wouldn't be interested in submitting a patch for this ticket, would you?
With the commit for #364287: State / Province drop down and Full State name in address field, a fix for this ticket won't be as straight forward as it would've been previously. If we want to add the configurability of a default state/province value, we'll need the form for doing so to be consistent with the input for state/province values when entering a state/province value on a location field.
Currently, if the state/province field is configured as an autocomplete, the autocomplete only pulls from the list of state/provinces of the country selected in the country input. Similarly, if the state/province field is configured as a select, the select changes via AJAX to only offer the list of provinces/countries in the country chosen on the select input for the country.
We'll probably want the interface for configuring a default state/province to look the same when configuring the location field. If the user wants it to be a select, we use the Form API AJAX features to change the input for the default state/province value into a select, with state/province options only available from the default country that has been chosen. If the user wants it to be an autocomplete field, we again use AJAX to change the input for the default value to an autocomplete, with the autocomplete options pulling from the list of state/provinces in the country entered as the default for the field.
Comment #12
dwwNo offense at all, and I totally understand the desire to cull the issue queue. ;) Didn't mean to scare you with my reply. However, I think it's just creating more work in the end if you close a bunch of valid feature requests that are then lost and then have to be re-submitted as people decide they want them...
Sadly, I don't have time/bandwidth right now to work on a patch for this, but yes, I'm still interested...
Cheers,
-Derek