Support

Account

Home Forums Add-ons Repeater Field Get select box values of advanced custom field

Unread

Get select box values of advanced custom field

  • I am using a repeater field type of a field.The parent field name is ‘map_details’ and the sub field name is ‘name_of_county’ which is a select dropdown list.

    Now I want to display all the values of that select box in the frontend.My code is

    $field_key = "field_535befe551ba5"; //field key of parent
    $field = get_field_object($field_key); 
    
    if( $field )
    {
        echo '<select name="' . $field['key'] . '">';
            foreach( $field['choices'] as $k => $v )
            {
                echo '<option value="' . $k . '">' . $v . '</option>';
            }
        echo '</select>';
    }

    it’s not working as I have given the field key of parent not the sub field which is basically a select box.Also I can’t find the field key for the sub field.

    How can I display the sub field dropdown box with values and keys in the frontend.

Viewing 1 post (of 1 total)

The topic ‘Get select box values of advanced custom field’ is closed to new replies.