Fixed #15344 - make select2 for countries freeform-ish #15367
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a sort of compromise for #15344, which correctly asserts that we do not validate country value on the API or importer. We cannot do that since the data sources on the admin's side may not comply with ISO 3166-1 alpha-2 codes or UK's extended codes, and would lead to model-level validation when those codes don't match when being entered/updated via API, CSV import, or SCIM (since the source data in the LDAP directory, SCIM directory, etc might not be compliant.)
The challenge is that if that info from the directory didn't match the ISO two letter codes, the field value for country would be accepted, but it would not be selected (since that arbitrary value doesn't exist in our countries array so it would never find a match to mark as the selected option) and thus that country value would be dropped on saving if the user didn't notice nothing was selected.
Screen.Recording.2024-08-22.at.11.03.07.AM.mov