To reproduce:
1. enable a location field (node_location, user_location, location_cck, etc).
2. set "collection settings" to require location
3. set "collection settings" to require State/Province
4. set "collection settings" to collect Country
5. go to the object's add page (e.g. node/add)
4. Choose a country with no states/provinces or an unsupported country, e.g. "Bouvet Island", "British Virgin Islands", "Christmas Island", "Falkland Islands", "Faroe Islands", "French Guiana", "Gibraltar", "Guadeloupe", "Guam", "Guernsey", "Isle of Man", "Jersey", "Lebanon", "Macedonia", "Martinique", "Mayotte", "Montenegro", "Netherlands Antilles", "Niue", "Norfolk Island", "Palestinian Territory", "Pitcairn", "Reunion", "Serbia", "Singapore", "Slovenia", "South Georgia and the South Sandwich Islands", "Svalbard and Jan Mayen", "Western Sahara", "Vatican", etc.
5. Try to save the object
6. Unable to save with validation error: "State/Province field is required."

Comments

gregstout’s picture

We have this problem too. We require location city/province/country. When some user enters, for instance, Singapore, then they cannot get registered because the country has no listed regions/provinces in the "supported" location.sg.inc file.

Has anyone solved this?

jessehs’s picture

subscribing

YesCT’s picture

Status: Active » Postponed (maintainer needs more info)

Please check to see if this is still a problem in the new release. If it is, reply with a new summary and set the status back to active. (maybe search on validate)

AaronBauman’s picture

Status: Postponed (maintainer needs more info) » Active

Same issue, same behavior as OP.

AaronBauman’s picture

I think the solution is going to have to go something like the following:

1. unset #required for "state/province" even when location settings set it as required.
2. add the visual indication to the UI that state/province is required (the red asterisk).
3. use validation handler to require state/province when applicable, ignore when not applicable
4. add javascript to hide, disable, or otherwise indicate that "state/province" is not applicable when a country without states/provinces is chosen.

Let me know if that sounds like a good way to go, or if you have any feedback, and I'll work on a patch.

rooby’s picture

This is way old but I jsust came across it.

The solution outlined in #5 sounds good to me.

datarazor’s picture

Issue summary: View changes

I'm surprised this is still an issue that hasn't been addressed. For many countries there are no provinces and the province/state field should not be displayed (hidden) when it doesn't apply. Since the field uses auto-complete you can't just use JS to hide the field and need to do it with some PHP.

datarazor’s picture

Version: 6.x-3.x-dev » 7.x-3.1