Home Forums Backend Issues (wp-admin) Select field not showing 'selected' choice


Select field not showing 'selected' choice

  • When I save a select option it gets written in the DB ok, but when I go back to that entry my choice is not selected (always the first). I got the $field variable printed out and I got the following. Any solutions?

        [key] => field_51e6df6688137
        [label] => Service Type
        [name] => fields[field_51e6df6688137]
        [_name] => service
        [type] => select
        [order_no] => 0
        [instructions] => 
        [required] => 1
        [id] => acf-field-servico
        [class] => select
        [conditional_logic] => Array
                [status] => 0
                [rules] => Array
                        [0] => Array
                                [field] => null
                                [operator] => ==
                [allorany] => all
        [choices] => Array
                [a] => a
                [b] => b
                [c] => c
        [default_value] => 
        [allow_null] => 0
        [multiple] => 0
        [field_group] => 531
        [value] => Array
                [0] => 28

    I’m using a, b and c as choices to make sure they’re ok. Seems like [value] should be my choice to comply with this code on select.php:136:

    $selected = in_array($key, $field['value']) ? 'selected="selected"' : '';

  • Have you ever managed to solve this one? I’m having the same issue after inserting values in the post_meta by hand

  • Is the same for me. I use the selector to list font-families to apply them in CSS. I can make a selection but If I come back to settings panel and change other configuration (other field), the font-family fiels is overwritten with the first option.

    Some solution? I’m using ACF PRO 5.1.3 Pro in WP 4.0

  • Yea, having the same problem. Been strugeling with a work-around, but no solution so far.

    Anyone else?

  • It’s related with some chracters, probable “,” or spaces…, but I need to use spaces or commas…, I dont know how to get the label name, in the label its like there is no problems with special characters

  • I’m using this function to convert the string and use the special chracters which the dropdown selector is having problems. Hope this can be fixed soon:

    function select_wsafe_font($fs) {
        if ($fs == "arial_bla") $fs = "'Arial Black', sans-serif";
        if ($fs == "arial_hel") $fs = "Arial, Helvetica, sans-serif";
        if ($fs == "centh_got") $fs = "Century Gothic, sans-serif";
        if ($fs == "couri_new") $fs = "'Courier New', Courier, monospace";
        if ($fs == "georgia") $fs = "Georgia, Serif";
        if ($fs == "impact") $fs = "Impact, Charcoal, sans-serif";
        if ($fs == "lucid_san") $fs = "'Lucida Sans Unicode', 'Lucida Grande', sans-serif";
        if ($fs == "palatino") $fs = "'Palatino Linotype', 'Book Antiqua', Palatino, serif";
        if ($fs == "tahoma") $fs = "Tahoma, Geneva, sans-serif";
        if ($fs == "times_new") $fs = "'Times New Roman', Times, serif";
        if ($fs == "trebuc_ms") $fs = "'Trebuchet MS', Helvetica, sans-serif";
        if ($fs == "verdana") $fs = "Verdana, Geneva, sans-serif";
        // Google Fonts
        echo $fs;
    } // END Selector Web Safe Font
  • I am having a similar issue. I have a select field with 60 or so values (with separate labels / values). When I add in a new value in the select field, and go to a page that already has a value set in the select field, it shows as blank (the first option in the select box). At this point, in the Database it is still correct. Once I click Update/Publish, it then incorrectly changes it to the first value/blank value.

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

The topic ‘Select field not showing 'selected' choice’ is closed to new replies.