Closed (works as designed)
Project:
Drupal core
Version:
8.9.x-dev
Component:
field system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 Nov 2012 at 15:09 UTC
Updated:
30 Sep 2021 at 12:27 UTC
Jump to comment: Most recent
Comments
Comment #1
pjcdawkins commentedEntity forms start off with default values for new entities. But when you're editing an existing entity, then form elements for fields & properties are populated with the existing values for that entity.
It appears to be documented well. When you edit a field, the "Default value" section has this description:
So this is surely "works as designed" unless I've misunderstood the OP.
Comment #2
nancydruIt may work as designed, but, IMHO, the design is flawed. If a node is edited and has no value for a field with a default value, then that default should be used, new node or not. This is the way most Forms API developers create forms.
Comment #3
swentel commentedAlso tempted to call it by design, or else rather a feature request than a bug. Needs to move to 8.x first
Comment #4
swentel commentedOh wait, that is definitely a bug - or at least relatively easy to fix.
(edit, although, still, maybe not a bug, I don't know, depends on expectations I guess)
Comment #5
nancydruLook at most Forms implementations, including many in core:
Maybe it's a feature request; I don't care what it's called. It is a major annoyance the way it is now.
Comment #6
pjcdawkins commentedWell, the behaviour is clearly not a mistake, given the default-value-widget description I mentioned - "The default value for this field, used when creating new content". That sentence (in
field_ui.admin.inc) appears to have been around since August 2009 according to git blame and it might even have been inherited from CCK.Perhaps a D7 Field maintainer could explain why defaults only ever applied to creating new content - maybe contact @yched.
Comment #10
drugan commentedThe example how it could be resolved is here:
#2816859: Allow the 'step' to be configured as a NumberWidget setting
It works on the number field exactly as suggested @NancyDru on #2.
Comment #16
pameeela commentedComment #17
pameeela commentedComment #18
catchMoving this back to works as designed, if we implemented it as suggested, then even if you zeroed out a default value when you saved, it would be set back to the default next time you edited.