Home Forums General Issues Repeater field + Auto populate select


Repeater field + Auto populate select

    • Bobz

    • August 15, 2013 at 3:24 am


    Maybe it’s out of scope of support, but I will ask anyway ๐Ÿ™‚
    I have this:

    It’s option page where you can add

    1. Country
    1.1. Cities (name)
    2.2. Areas (name + image)

    Everything is repeatable ๐Ÿ™‚

    So what I’m trying to achieve is

    When user selects country, he then gets 2 select fields
    1. Select Nearest City
    2. Select Area

    And I want to populate these select boxes with data from selected country only.
    Here is screenshot of the field in admin:

    Would appreciate if you could point me somewhere, because i’m stuck.


    • Elliot

    • August 15, 2013 at 2:20 pm

    Hi @bobz

    Thanks for the question.

    Yes, it is possible, but it will not be easy.

    May I ask where it is that the user will select the country? Is this somewhere on the front end of the website?

    • Bobz

    • August 15, 2013 at 5:16 pm

    Hi elliot,

    Everything is on backend, I have this custom post types with 30 custom fields.
    If it’s to complicated I will remove city from it and make it input field, then i would have only Country and Area.
    I always try to make more user friendly but then I put myself in trouble ๐Ÿ˜›


    • Elliot

    • August 16, 2013 at 1:09 pm

    Hi @bobz

    Can you please be more clear. What post types?
    How do ’30 custom fields’ relate to this question?


    • Bobz

    • August 22, 2013 at 2:00 am


    Sorry for late reply.
    I’m kind of to busy to think on anything else.

    Anyway I have simplified things a little bit I will create special page for areas and special for cities.

    • Bobz

    • August 24, 2013 at 2:58 am


    I’m not able to make this work.
    I have added:

    function my_acf_load_field2( $field )
        $field['choices'] = array(
            'custom' => 'My Custom Choice'
        return $field;
    // acf_load_field-{$field_key} - filter for a specific field based on it's key
    add_filter('acf_load_field-field_520fa5c4c3ce6', 'my_acf_load_field2');

    to my functions.php, but it doesn’t work.
    I’m trying to populate select field:

    <select id="acf-field-reserve_country" class="select" name="fields[field_520fa5c4c3ce6]">

    I use ACF as a plugin.
    Doing something wrong?

    • Elliot

    • August 25, 2013 at 4:19 pm

    Hi @bobz

    If you are using ACF v4 or above, you will need to change the filter name to this:


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

The topic ‘Repeater field + Auto populate select’ is closed to new replies.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.