#2392059: Choosing -None- still saves a row in the database has shown that the default values instance setting is broken for optional fields:
If a field is optional, and has a default value, it can never be submitted empty, the default values will always be saved instead.
This is a core bug with no fix in sight (too big of an API change for D7).

Since the defaults are merged in before our widget form function is called, this setting also makes it very hard to precisely implement #2392855: Provide a hook for altering address defaults , since we can't distinguish a real value from a default one.

The suggested fix is to remove the default values instance setting (#access => FALSE), and introduce a "Default country" dropdown.
Setting the default country is the 90% use case for this setting, so having it in the UI means that most users won't notice a regression.
An update hook will set the default country from the previous default values, except for optional fields, where the default will be "None".
The rest of the defaults can be provided via the hook.

Comments

bojanz’s picture

Issue summary: View changes
bojanz’s picture

Issue summary: View changes
bojanz’s picture

Status: Active » Fixed

Done.

  • bojanz committed 1480032 on 7.x-1.x
    Issue #2392863: Remove the default values instance setting, introduce a...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rosell.dk’s picture

When I ran an update from 1.0beta5 to 1.0, the default country setting was not set to previous value - even though the field is set to be required, and we ran update.php

Marko B’s picture