I created a content type, and set a default value. When I created a piece of content of this type, the default value that I set did not show up in the edit form. When I entered a value and saved the piece of content, the original default value was shown instead of the value I entered. I got this error: "Warning: Invalid argument supplied for foreach() in Drupal\Core\Entity\Entity->__construct() (line 72 of core/lib/Drupal/Core/Entity/Entity.php)."

To reproduce:

  1. Install Drupal 8
  2. Create content type
  3. Add a text field
  4. Set default value for the text field as XYZ and save the field
  5. Create a piece of content of this type and note that the default value does not appear in the text field
  6. Enter a value in the field and save the content
  7. Not that the value for the text field is the same value that you inserted as default value when creating the content type, not the value you entered when creating the specific piece of content

I'd expect the default value to prepopulate the text field when creating a piece of content, and for that value to be overridden if I enter a value and then save it.

Comments

swentel’s picture

Title: Default value for text field behaving strangely - not displaying in content creation yet impossible to override » Default value for text type can not be on field edit form
Priority: Normal » Major

This even got worse now, you can't even set a default value anymore

Symfony\Component\Validator\Exception\ConstraintDefinitionException: Either "choices" or "callback" must be specified on constraint Choice in Symfony\Component\Validator\Constraints\ChoiceValidator->validate() (line 36 of

This affects others maybe too.

swentel’s picture

Priority: Major » Normal
Status: Active » Closed (works as designed)

Actually, my bad, had a wrong setup, this works fine now, probably fixed in another issue.