Support

Account

Home Forums General Issues Using values from one field group in another

Solving

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.

  • 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

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Using values from one field group in another’ is closed to new replies.