Problem/Motivation
If an address field is not required, any 'required' address components will nevertheless be required on form validation. For example, a US address requires these components: address line 1, city, state, zip and error messages will display for any that are empty. This is quite inconsistent.
The 'Make all fields optional' format handler attempts to address this, although in a manner 'unsuitable for postal purposes' as stated by the module.
Steps to reproduce
- add an address field to an entity,
- set it to not be required,
- display the edit form,
- leave a required address component empty,
- click save
Proposed resolution
Add a 'format' plugin for a conditional address. This plugin will only validate an optional address if at least one required component is set. In this way, if the user does not enter an address, he will not be shown error messages. However, the user will not be able to save an incomplete address.
Remaining tasks
Review and test manually, no automated tests to be written.
User interface changes
None on entity edit form; new format handler on manage field form.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#3 | addressfield-2831553-3-add-format-plugin.patch | 3.83 KB | solotandem |
Comments
Comment #2
solotandem CreditAttribution: solotandem commentedComment #3
solotandem CreditAttribution: solotandem commentedAttached patch implements proposed changes.