Hi, is there a way to dynamically populate fields after a Post Object has been chosen?
I had a ‘documents’ Flexible Content area that could be added to pages. This contains a repeater field which allows users to add sinmgle documents. Each document’s details ACF fields were Title, description, publisher name, published date and a file upload.
We now want a new Documents section of the WordPress admin. I’ve created a documents CPT so that each new document now has it’s own page I can link to. It uses exactly the same fields.
What I have done is when a user adds a document to the existing documents Flexible Content area on a page they have the option of either entering the document’s details as usual (the document doesn’t have it’s own page and does not interact with the Documents CPT) or the user can select a document from the new Documents CPT (using the Post Object field).
What I would like is that when a Document Post Object is chosen is that the ACF fields in this section are populated from the fields in the CPT Document. Is this possible?
1. Inside repeater field a Document is selected from Post Object field showing all Documents in CPT.
2. Once selected, get fields from this Document’s Post Object.
3. Overwrite fields in the repeater field with these CPT fields.
I hope that makes sense. Is it possible? I just want to site administrator to see that they’ve chosen the right document and to save them typing out these fields again.
Yes it is, but it is complicated and not well documented.