Problem/Motivation

After applying patch from Time element fails validation when an empty value is submitted via API #16 . Although I did go from latest RC to latest dev, so there is a small chance it could be something else.

Date Time validation fails when inside a custom composite from Webform Composite Tools

This does not happen when not using a composite, but prior to the patch, it worked fine inside a composite.

How to reproduce

Here is a source export:

test2:
  '#type': custom_composite
  '#title': test2
  '#element':
    test3:
      '#type': datetime
      '#title': test3
      '#date_date_element': datepicker
      '#date_date_format': d/m/Y
      '#date_time_element': timepicker
      '#date_time_format': 'g:i A'
      '#date_time_step': '900'
      '#autocomplete': 'off'

Result:

error

Comments

No Sssweat created an issue. See original summary.

no sssweat’s picture

Title: Invalid date when using "custom composite" element. » Invalid datetime when using "custom composite" element.
no sssweat’s picture

Issue summary: View changes
no sssweat’s picture

Issue summary: View changes
jrockowitz’s picture

StatusFileSize
new4.33 KB

The attached webform replicates this issue.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new1.39 KB

This patch fixes the issue which is related to the custom time format within composites and multiple value elements.

This solution needs some additional test coverage to prevent any additional regressions.

jrockowitz’s picture

StatusFileSize
new6.51 KB
no sssweat’s picture

Status: Needs review » Needs work

I have downloaded the latest dev version and applied the patch and the issue still persists.

When I apply the patch this is what it says:

$ git apply -v 3027468-7.patch
Checking patch css/webform.element.multiple.css...
Checking patch src/Element/WebformTime.php...
Checking patch src/Plugin/WebformElement/DateBase.php...
Checking patch src/Tests/Element/WebformElementDateTimeTest.php...
Checking patch tests/modules/webform_test/config/install/webform.webform.test_element_date.yml...
3027468-7.patch:112: new blank line at EOF.
+
Checking patch tests/modules/webform_test/config/install/webform.webform.test_element_datelist.yml...
Checking patch tests/modules/webform_test/config/install/webform.webform.test_element_datetime.yml...
3027468-7.patch:173: new blank line at EOF.
+
Applied patch css/webform.element.multiple.css cleanly.
Applied patch src/Element/WebformTime.php cleanly.
Applied patch src/Plugin/WebformElement/DateBase.php cleanly.
Applied patch src/Tests/Element/WebformElementDateTimeTest.php cleanly.
Applied patch tests/modules/webform_test/config/install/webform.webform.test_element_date.yml cleanly.
Applied patch tests/modules/webform_test/config/install/webform.webform.test_element_datelist.yml cleanly.
Applied patch tests/modules/webform_test/config/install/webform.webform.test_element_datetime.yml cleanly.
warning: 2 lines add whitespace errors.

jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.55 KB
new7.06 KB

Are you sure that patch is not working? This patch even includes your original example in the test (see the interdiff).

no sssweat’s picture

Turns out on my live site the webform module is inside the /modules/contrib folder, but not in my local.

So when I put it in the /modules/contrib folder in my local, I accidentally ended up with 2 webform modules and it was still reading the original one in the root /modules folder.

Works perfectly, thank you so much! Sorry to keep you up at night.

no sssweat’s picture

Status: Needs review » Reviewed & tested by the community

  • jrockowitz committed a991eb9 on 8.x-5.x
    Issue #3027468 by jrockowitz, No Sssweat: Invalid datetime when using "...
jrockowitz’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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