Support

Account

Home Forums General Issues Fill select with entries from other CPT repeater?

Helping

Fill select with entries from other CPT repeater?

  • I’m planning – and trying to get my head around – some CPT relationships in ACF for a music festival site.

    There will be the following CPTs defined:
    – concert
    – musician
    – composer
    – venue

    Musicians, Composers and Venues will be related to Concerts using reverse relationships Post Object fields (http://support.advancedcustomfields.com/forums/topic/return-value-of-post-object-field/).

    Ideally there should be a way to define Sub-venues, e.g. Covent Garden > auditorium, Covent Garden > Patio, Covent Garden > Hallway. This obviously is easily done using ACFs wonderful repeaters.

    What I can’t fathom right now is: is there a (somewhat) easy way to get these sub-venues to display as a select box in the Concert CPT?

  • Somewhat easy? That depends, do you want to show the Venue and the Sub Menu in separate select fields or would you want to display them the way you listen them above with the select field containing these items

    • Covent Garden > auditorium
    • Covent Garden > Patio
    • Covent Garden > Hallway

    The latter would be easier than the former:
    http://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/
    You can set the value to the sub venue ID and the label to what is above.

    If you want them in separate select fields than you’d need to create your own javascript and ajax to detect when the first on changes and update the second field. While possible, far more complicated.

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

You must be logged in to reply to this topic.