Open
Description
The following is not documented and may be confusing:
- Before the AJAX request exactly how POST PAYLOAD DATA (by the data-live-props-value) are built to be submitted
- After the AJAX what data-live-props-value html attribute will finally be.
I ask this because I came accross with the following:
- I have a live form with ChoiceType (datetimes)
- AJAX is called (because I pushed the button submit)
- My datetimes (ChoiceType) were updated during PRE_SUBMIT event, because of they are dynamic
- All the possible choices not contain PAYLOAD[datetime] because it's already doesn't exist among choices, as a result normalized version of the data is
null
because of the default ChoiceType data transformer - AJAX is finished and I have the old datetime in the data-live-props-value attribute, because it was not changed via frontend but because of the internal logic choices changed (in the PRE_SUBMIT event) I have
null
model data - FINALLY: I have
null
model datetime data, but I expected I was the first element of the choice
To solve this I needed to empty formValues before form creation to make data-live-url-value contain first choice element instead of the old currently non-existent element in the choice
But currently it's not clear
In case I did NOT empty formValues before the form creation I would constantly get empty normalized data in my MODEL/ENTITY because data-live-props-value html attribute would constantly contain old non-existent choice unless it was selected from frontend (in this case it would be updated as normal)