Problem/Motivation
Custom Composite element allow users to use the Date elements inside of it, but it takes a lot of the options/properties you have in the "standalone" Date element for the sake of UI (I believe).
To allow users to get these options/properties set on the Custom Composite child elements we have the Custom Properties field. All good.
The issue is that when building a multi-page (or one-page preview enabled) webform, with a Date element inside a Custom Composite and setting it to have a datepicker and a different date format other than "YYYY-MM-DD", the data gets lost as it moves between pages or pass through the preview.
This doesn't happen for one-page webforms the are directly submitted to the database.
This doesn't happen for Date elements that are outside Custom Composite elements.
I'm attaching 2 different YAML files for the test webforms I've created.
Use it and try to enable/disable the preview to see the difference on the behavior.
Proposed resolution
I don't really have a solution for this because I couldn't really figure out where the data was getting lost.
I was able to see the data in the WebformSubmission object right after going to the next page, and I notice it was set to the standard format (YYYY-MM-DD).
My guess is that whenever moving the data, some validation (or other step in the process) tries to match the YYYY-MM-DD format to the custom date format I've set (d/m/Y) and when it doesn't match, it loses the data.
Comment | File | Size | Author |
---|---|---|---|
#3 | 2973063-3.patch | 1.48 KB | jrockowitz |
| |||
#2 | webform.webform.issue_2973063l.yml | 4.92 KB | jrockowitz |
webform_composite_dates--paged.yml | 1.44 KB | dscl | |
webform_composite_dates--one_page.yml | 1.15 KB | dscl |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe attached webform replicates the issue.
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #4
dscl CreditAttribution: dscl at DevBrains commentedWow, that was quick!
Thanks a lot for your effort on this.
I've reviewed it and test, works perfectly.
And also allows me to better understand the flow of data.
Cheers!
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented