When I create a dependency on an entity reference field (taxonomy term) to have a specific term out of this vocabulary the following error shows up on the page. It appears everything is working as expected though.

Notice: Undefined index: value in Drupal\conditional_fields\Form\ConditionalFieldEditForm->submitForm() (line 316 of modules/contrib/conditional_fields/src/Form/ConditionalFieldEditForm.php).

Drupal\conditional_fields\Form\ConditionalFieldEditForm->submitForm(Array, Object) (Line: 27)
Drupal\conditional_fields\Form\ConditionalFieldEditFormTab->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('conditional_field_edit_form_tab', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('conditional_field_edit_form_tab', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

pektinasen created an issue. See original summary.

romixua’s picture

Status: Active » Needs review
StatusFileSize
new845 bytes

We get this error not only depending on the taxonomy term.

gg24’s picture

StatusFileSize
new853 bytes

Creating a new patch and adding the is_object condition too.
Please review the patch.

guptahemant’s picture

Status: Needs review » Reviewed & tested by the community

hi @gg24,
I have tested the patch provided and it solves the mentioned issue.
Hence marking the issue as RTBC.

colan’s picture

Title: Error when creating dependency on taxonomy term » Undefined index value in ConditionalFieldEditForm->submitForm

More descriptive title.

  • colan committed 468c39e on 8.x-1.x authored by gg24
    Issue #2908866 by gg24: Checked if there's a value and if it's an object...
colan’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Jorge Navarro’s picture

Using latest version, I still get the error after adding a dependency on a content type:

Notice: Undefined offset: 0 in Drupal\file\Plugin\Field\FieldWidget\FileWidget->formMultipleElements() (line 196 of core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php).
Drupal\file\Plugin\Field\FieldWidget\FileWidget->formMultipleElements(Object, Array, Object) (Line: 84)
Drupal\image\Plugin\Field\FieldWidget\ImageWidget->formMultipleElements(Object, Array, Object) (Line: 104)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 168)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 122)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 113)
Drupal\node\NodeForm->form(Array, Object) (Line: 117)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 514)
Drupal\Core\Form\FormBuilder->retrieveForm('node_documents_edit_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('node_documents_edit_form', Object) (Line: 520)
Drupal\conditional_fields\Form\ConditionalFieldEditForm->getDummyField('node', 'documents', Array, Object, Array) (Line: 145)
Drupal\conditional_fields\Form\ConditionalFieldEditForm->buildForm(Array, Object, 'node', 'documents', 'field_documento', '6c213a15-2da7-4ec4-be6c-ad74e0694b92')
call_user_func_array(Array, Array) (Line: 514)
Drupal\Core\Form\FormBuilder->retrieveForm('conditional_field_edit_form_tab', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('conditional_field_edit_form_tab', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined offset: 0 in Drupal\image\Plugin\Field\FieldWidget\ImageWidget->formMultipleElements() (line 90 of core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php).
Drupal\image\Plugin\Field\FieldWidget\ImageWidget->formMultipleElements(Object, Array, Object) (Line: 104)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 168)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 122)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 113)
Drupal\node\NodeForm->form(Array, Object) (Line: 117)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 514)
Drupal\Core\Form\FormBuilder->retrieveForm('node_documents_edit_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('node_documents_edit_form', Object) (Line: 520)
Drupal\conditional_fields\Form\ConditionalFieldEditForm->getDummyField('node', 'documents', Array, Object, Array) (Line: 145)
Drupal\conditional_fields\Form\ConditionalFieldEditForm->buildForm(Array, Object, 'node', 'documents', 'field_documento', '6c213a15-2da7-4ec4-be6c-ad74e0694b92')
call_user_func_array(Array, Array) (Line: 514)
Drupal\Core\Form\FormBuilder->retrieveForm('conditional_field_edit_form_tab', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm('conditional_field_edit_form_tab', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
colan’s picture

#9: This issue is closed. Please open a new one (referencing this one if it's related), or working on another open existing one if it exists. Thanks.

Road Kill’s picture

brooke_heaton’s picture

Disregard.