Support

Account

Home Forums General Issues Disabled option for select fields Reply To: Disabled option for select fields

  • I’m suggesting adding a to the field choices for example

    
    $field['choices'] = array(
      '' => 'This value is NULL'.
      1 => 'This is a valid value'
    );
    

    Any array index of ” does work in PHP and this is what ACF uses for the value. The rest of it should be handled by ACF. The empty string index cannot be added through the ACF field setting, but I think it could be added in PHP.

    ….

    But your idea will work as well. You can have a set of values in the field settings like

    
    not allowed : select your occupation
    butcher
    baker
    candle stick maker
    

    Then you can create an acf/validate_value filter for your field that displays an error if that value is selected https://www.advancedcustomfields.com/resources/acf-validate_value/