Problem/Motivation

The default values are added at the widget, but only if the entire entity is new. This means if there is a form display mode without the address field which saves the entity and then a form display mode, it will have no default value. I imagine this is due to not knowing whether the was previously stored empty vs has never been attempted before.

Proposed resolution

If a field is required but empty, it seems reasonable to apply the default value.

Comments

andrewbelcher created an issue. See original summary.

andrewbelcher’s picture

Assigned: andrewbelcher » Unassigned
Status: Active » Needs review
StatusFileSize
new1.11 KB

Here's a patch to do that.

andrewbelcher’s picture

Title: Use defaults on empty required address fields » Address defaults misapplied or not applied
Category: Task » Bug report
Priority: Normal » Major
StatusFileSize
new1.13 KB

Ah, if the entity is new, but a value has already been set, the defaults are always applied. So bumping to a major bug, but also including an update patch that fixes both.

dww’s picture

Yes, the whole approach address.module is taking for default values is broken. See #2838457: Re-enable the default value functionality for Address fields. I don't think this patch is really what we're going to want. I think we need to rip out the widget-based default nonsense and restore normal field-based defaults.

I'm tempted to mark this issue duplicate, but I'll leave it for now.

bojanz’s picture

Status: Needs review » Closed (duplicate)

I agree with #4. Happening soon.