cms icon indicating copy to clipboard operation
cms copied to clipboard

[4.x]: Craft deletes content of already filled fields

Open maxstrebel opened this issue 3 years ago • 1 comments

What happened?

Description

If you create a new Entry or edit an existing one and miss several required fields , Craft will delete already filled required fields after on save.

I'd be really really happy to have a reliable behavior again. We currently have a client that has a lot of problems in the backend with scrambled NEO blocks on save, Mutex locks, etc. – and currently we have 2 sites on hold because saving in the backend will cause content to be broken. The current state of content editing is not stable.

Steps to reproduce

  1. Create a new entry which contains more than one required field
  2. Leave all required fields empty
  3. Save
  4. It will show the errors
  5. Fill one required field
  6. Save
  7. Error will be gone on the field
  8. Fill the next required field
  9. Save
  10. Text from the last required field will be gone

Additional

  • If you empty a field afterwards and edit another field and save, it will get its original value back.
  • With a "Typed Link Field (Plugin)" in the mix in a Matrix, validation completely fails

Expected behavior

Fields that are filled should always keep their actual value. If I empty a field, it should stay empty and throw an error. If I edit a field, it should not affect other fields.

Actual behavior

Fields can lose their value. This seems to happen at random. Sometimes it will remove an already existing value, sometimes not. It seems to help to wait for the autosave to finish.

Craft CMS version

4.2.0.2 & 4.2.1

PHP version

8.0.19

Operating system and version

MacOS Monterey 12.5

Database type and version

MySQL (mariadb 10.5.13)

Image driver and version

Imagick 3.7.0 (ImageMagick 7.1.0-35)

Installed plugins and versions

No response

maxstrebel avatar Aug 10 '22 08:08 maxstrebel

Happens with and without autosaveDrafts enabled.

https://user-images.githubusercontent.com/910594/183871838-86aae14a-6ba8-4ce1-9d08-0bc63f411c71.mov

maxstrebel avatar Aug 10 '22 09:08 maxstrebel

Thanks, this turned out to be the same underlying issue as the field value-forgetting bug you reported in #11731. I just didn’t look deep enough when looking into that.

Just released 4.2.1.1 with a proper fix for both.

brandonkelly avatar Aug 10 '22 17:08 brandonkelly

Thank you for the quick fix and release.

maxstrebel avatar Aug 11 '22 08:08 maxstrebel