You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a LiveComponent for a form. This form has dependent fields which have been implemented with the dynamic-forms bundle. I have a situation where I have select fields that are only added when certain other fields have been filled in. These select fields should have a preselected value. To do this, I set the value in the corresponding fields in the object for the initial form values. The problem is that these values disappear when the fields are added and therefore no value is preselected in the fields. There is already an issue for this in the dynamic-forms bundle. I have now debugged it and found out what the problem is. This is due to the $clearMissing parameter of the Symfony\Component\Form::submit function. This parameter is true by default. The function is called here without the 2nd parameter. If I set the 2nd parameter to false, the problem is solved. I could create a PR for it now, but unfortunately I can't assess whether this would have unwanted side effects. Can anyone say? Is it ok to set the $clearMissing parameter to false in the ComponentWithFormTrait on submit?
The text was updated successfully, but these errors were encountered:
I have a LiveComponent for a form. This form has dependent fields which have been implemented with the dynamic-forms bundle. I have a situation where I have select fields that are only added when certain other fields have been filled in. These select fields should have a preselected value. To do this, I set the value in the corresponding fields in the object for the initial form values. The problem is that these values disappear when the fields are added and therefore no value is preselected in the fields. There is already an issue for this in the dynamic-forms bundle. I have now debugged it and found out what the problem is. This is due to the
$clearMissing
parameter of theSymfony\Component\Form::submit
function. This parameter istrue
by default. The function is called here without the 2nd parameter. If I set the 2nd parameter tofalse
, the problem is solved. I could create a PR for it now, but unfortunately I can't assess whether this would have unwanted side effects. Can anyone say? Is it ok to set the$clearMissing
parameter tofalse
in theComponentWithFormTrait
on submit?The text was updated successfully, but these errors were encountered: