How to Programmatically Populate Data in Dynamic Fields?
I migrated a form from WS Form to FluentForms. There is one issue I could not yet solve: Ho can I populate the content of a dynamic field programmatically?
I added a dynamic field, set it to Multi-Select and retrieve the data from source Post. So the field now has all posts of a given post type available and stores the data as ID. Now I need to preselect certain posts where I already have the IDs of. How can I pre-select these in the field?
I tried to use default values. Get parameters is no option because there are already numerous params available (the page with the form uses facets). I tried default values from cookies, but they get cached, and once I open the page with the form the cookie gets read once and any further change is ignored.
Is there a hook that works with dynamic fields like fluentform/rendering_fielddata{$type}, then how does it work with dynamic fields?
Turned out the answer is: not at all. It looks like dynamic fields are just a lazy version of "code your own" without the needed features. I got this running by using a standard Multi-Select field and prefilled the values via PHP. It looks now precisely the same as the dynamic field, but works. The dynamic field just works for very generic cases (which I rarely have...).