Home › Forums › General Issues › Using values from one field group in another
I have two custom post types: committees and meetings. Each has custom fields. There is an implicit relationship between the two: i.e., committees hold meetings.
When creating a meeting, I would like to:
1. Choose from a dropdown of all committees created (which I believe I can do with post object, correct?)
2. Have the default value for a meeting field be populated with a value pulled from the selected committee. Use case: A particular committee usually meets in Room A, but sometimes has to move to Room B. The way I’m envisioning this is to set default_location on the committee page, which pre-populates meeting_location on the meeting page. This value could then be changed for that meeting if necessary.
3. Ultimately display a meeting page that shows a mix of committee information (e.g., a general committee description) and information unique to the meeting (date, location). Basic filtering should be able handle that part.
Is using post object the best way to go? Is #2 possible?
Thanks in advance,
Doug
I suppose I could side-step this by coding conditional logic on the template (display meeting_location for this meeting if it exists, else display default_location for this committee), but I think it would be a better user experience for the person creating the meeting to see the default location, and overwrite it if necessary.
Hi @dougfitz ,
This should help you in solving the first part of your problem.
https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
That does indeed work beautifully for populating the committee dropdown. Any thoughts on using that selection to set the default values for the meeting fields?
I’m also looking to solve a similar problem: I would like a select field to populate some text fields with related data. (My Select field is populated with custom taxonomy items, each of which have custom fields. I want their custom field data to populate the text fields.).
Any luck with this?
For Postgres use string_agg()
select id,
string_agg(name, ‘,’ order by name) as name_list
from the_table
group by id
order by id;
With Regards,
Protar
Did the way work?
With Regards,
Protar
https://plex.software/
https://tutuappx.com/
https://vidmate.onl/
The topic ‘Using values from one field group in another’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.