If javascript is disabled the state/provide field never shows up. If this field is required the form fails.

Would be nice to at least load the default countries field (probably often US state) DOM element on page load, then replace it if something else is selected.

Comments

johnhanley’s picture

Status: Active » Closed (won't fix)

A previous project description revision included the following:

"This module is dependent on a small inline snippet of JavaScript (jQuery) to perform its show/hide magic and does NOT degrade for users who have JavaScript disabled in their browser. If degradation is important to you, please do not use this module."

I agree some sort fallback would be ideal, but given my current professional and personal obligations this modification is unlikely to happen. Patches gladly accepted.

Please reopen this issue if you or someone would like to submit a patch.

johnhanley’s picture

Status: Closed (won't fix) » Postponed
doublejosh’s picture

Status: Postponed » Active

Thanks.
Totally fine. Let's leave open if/when I create this patch :)

iamEAP’s picture

Status: Active » Needs review
StatusFileSize
new3.91 KB

Here's a patch that takes care of the issue.

This adds a third field profile_territory_fallback. The field is displayed by default and hidden via JS so that if JS is enabled, the module functions as usual, but if not, the user stills sees something.

I chose to include both state and province values in the field options, separated by a blank "--- select a province ---" option.

Added some logic to the profile_location_validate_handler so that:

  • If the user put anything in the fallback field, the value is copied to both province and state fields. This leverages the existing logic to selectively use either state or province (or NULL) depending on the country selected.
  • Added one additional bit of logic to the condition for form_set_error which checks for the fallback field being empty.
johnhanley’s picture

@iamEAP, thanks for the patch!

I'm swamped right now and don't have time to adequately test, but maybe the OP has time.

@doublejosh, what say you?

doublejosh’s picture

I work with Eric on the same site. We can bang on it and have other staff test a bit for sure.

johnhanley’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Closing due to Drupal 6 end-of-life cycle.