Problem/Motivation
In a multistep webform with almost one field date, when webform is submitted throws following error:
Error message
Notice: Undefined index: object in Drupal\webform\Plugin\WebformElement\DateBase::validateDate() (line 358 of modules/contrib/webform/src/Plugin/WebformElement/DateBase.php).
Proposed resolution
I have checked if $value has a 'object' index and if else, I check if it is an array, I pass the correct $value argument to 'date_create_from_format' function.
I have attached a patch to fix this.
Comments
Comment #2
daniel ortega commentedComment #4
daniel ortega commentedComment #5
jrockowitz commented@Daniel Ortega I can't replicate this issue using the attached webform which contains 2 pages with date and datelist elements.
Comment #6
igalafate commented@jrockowitz I have the same issue and, looking at your config, the thing is when I export the form I get the "'#multiple': 0\n" config added to my date field even if I do not change anything from the UI. I am using the 8.x-5.0-rc3 version of Webform. Is it possible you are using the dev one or maybe you have patched it?
Please, see attached your version after I have save the "date_1" field. By the way, thank you for your attaching your config file, it was the key to see the issue.
Comment #7
jrockowitz commentedWow, the
'#multiple': 0is triggering this error when I page next and previous on the attached webform.What is even more remarkable is
'#multiple': 2is fine.The 0 is probably causing some unexpected issue via an
empty()call.Comment #8
jrockowitz commentedSo
'#multiple': 0is not really supported via the UI and was probably set via edit the YAML source. Still we should try to account this value.Comment #9
jrockowitz commentedI committed the patch. Please download the latest dev release to review.