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/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.