Problem/Motivation
Create a new standard installation of Drupal 9.5.0
composer require drupal/webform:^6.2@beta
composer require drupal/jquery_ui_datepicker
drush en webform_jqueryui_datepicker webform_ui -y
Log in as user 1
Go to /admin/structure/webform
New webform "test"
Create webform with:
test:
'#type': datetime
'#title': test
'#multiple__no_items_message': '<p>No items entered. Please add items below.</p>'
'#format_items': comma
You will now see
Error message
Warning: Undefined array key "#date_date_element" in _webform_entity_element_validate_rendering_error_handler() (line 1107 of modules/custom/webform/webform.module).
_webform_entity_element_validate_rendering_error_handler(2, 'Undefined array key "#date_date_element"', '/var/www/html/modules/custom/webform/modules/webform_jqueryui_datepicker/webform_jqueryui_datepicker.module', 195) (Line: 195)
webform_jqueryui_datepicker_webform_element_alter(Array, Object, Array) (Line: 562)
Drupal\Core\Extension\ModuleHandler->alter('webform_element', Array, Object, Array) (Line: 184)
Drupal\webform\Plugin\WebformElementManager->buildElement(Array, Array, Object) (Line: 2572)
Drupal\webform\WebformSubmissionForm->prepareElements(Array, Array, Object) (Line: 828)
Drupal\webform\WebformSubmissionForm->form(Array, Object) (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object) (Line: 641)
Drupal\webform\WebformSubmissionForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 534)
Drupal\Core\Form\FormBuilder->retrieveForm('webform_submission_test_add_form', Object) (Line: 281)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 570)
Drupal\webform\WebformEntityElementsValidator->validateRendering() (Line: 217)
Drupal\webform\WebformEntityElementsValidator->validate(Object) (Line: 137)
Drupal\webform\WebformEntityElementsForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'webform_source_form') (Line: 118)
Drupal\Core\Form\FormValidator->validateForm('webform_source_form', Array, Object) (Line: 591)
Drupal\Core\Form\FormBuilder->processForm('webform_source_form', Array, Object) (Line: 323)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
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}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 707)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Steps to reproduce
See above.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3332440-3.patch | 971 bytes | jrockowitz |
| #2 | webform.webform.issue_3332440.yml | 4.94 KB | jrockowitz |
Comments
Comment #2
jrockowitz commentedI am not able to replicate this issue using the attached webform.
Comment #3
alberto56 commentedThanks, I assume you meant to use the status "postponed (maintainer needs more info)" so I set it to that.
I will add that I am using PHP 8.1 which might explain why you're not seeing the issue. On a brand new Drupal site with that webform, I am seeing the problem, and in addition, the datepicker does not appear resulting in mismatched date formats.
My workaround is to to use a "date" only field (not "datetime") and then a separate field for the time.
Comment #4
jrockowitz commentedI can't replicate the error, but I can see the issue via the code.
If all the tests pass, I will commit the patch.
Comment #5
jrockowitz commentedComment #6
alberto56 commentedThanks!
Comment #9
loopy1492 commentedI have 6.2.0-beta-5 installed and I'm getting this on our webforms. That version seems to have the code from this issue in it. Does anyone have any thoughts?
We are running php 8.1 and drupal 9.5.7.
Comment #10
loopy1492 commentedIt's possible it has to do with using tokens in the title of a fieldset:
Comment #11
loopy1492 commentedI was wrong. This seems to be happening when I use the "Date List" element type. When I switch to "Date", the error goes away. Is it possible that the datepicker is trying to apply itself to a field that shouldn't be using a datepicker? I think perhaps I need to make a new issue.
Comment #12
entropea commentedAlso seeing this in latest version with D10. Fine when using Date type, but when datelist is used we see this warning.