What are the steps required to reproduce the bug?
1. Create a new content type.
2. Set the body field to required.
3. Add another field like an image, or multiple entity reference.
4. Add a new node of content type and upload an image while leaving the body field empty.
What behavior were you expecting?
The image just being uploaded, or a extra entity reference field being added.
What happened instead?
The image wasn't uploaded, the ajax request returned empty, but when you do fill in the body field, the image upload does work.
Logs
When it fails, the ajax request returns empty, and gives the error I attached in a screenshot from chrome devtools.
In dblog i get 3 errors, first one comes first.
Notice: Undefined offset: 0 in Drupal\text\Plugin\Field\FieldWidget\TextareaWithSummaryWidget->errorElement() (line 95 of /webdata/www/core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php).
Notice: Undefined index: in Drupal\text\Plugin\Field\FieldWidget\TextareaWithSummaryWidget->errorElement() (line 95 of /webdata/www/core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php).
Recoverable fatal error: Argument 1 passed to Drupal\Core\Form\FormState::setError() must be of the type array, null given, called in /webdata/www/core/lib/Drupal/Core/Field/WidgetBase.php on line 449 and defined in Drupal\Core\Form\FormState->setError() (line 1144 of /webdata/www/core/lib/Drupal/Core/Form/FormState.php>).
Comment | File | Size | Author |
---|---|---|---|
#4 | 2553983-textarea-4-PASS.patch | 3.48 KB | tim.plunkett |
#4 | 2553983-textarea-4-FAIL.patch | 2.43 KB | tim.plunkett |
#3 | 2553983-textarea-violation-3.patch | 1.05 KB | tim.plunkett |
Screenshot 2015-08-19 17.07.33.png | 150.89 KB | JanLaureys |
Comments
Comment #2
JanLaureys CreditAttribution: JanLaureys commentedComment #3
tim.plunkettConfirmed! This is related to violation property paths being unreliable.
Here is a temporary fix.
Comment #4
tim.plunkettOkay, here's a test.
Comment #5
tim.plunkettComment #8
xjmSince this involves unpredictable fatal errors for end users after the site builder assembles a fully supported data model in the UI alone for a common usecase, that is a strong case for this issue to be considered as a major.
Comment #9
alexpottShould this be part of the WidgetBase implementation - given other issues like #2614250: Number widget validation can break AJAX actions. Or is that what #2027059: Improve the documentation of WidgetBase::errorElement() for mapping violation property paths to form elements is trying to do. We seem to have a number of issues in the this area.
Comment #13
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThis problem is handled generically in #2901943: Content entity form validation does not respect the #limit_validation_errors property from field widgets.