Home › Forums › General Issues › image selection and conditional logic
Hi all,
I looked over internet to find an answer but didn’t find anything I could use in this case. I have 2 fields: the first one is an image selection field and the second one should show only when an image is selected. I can’t solve how to make proper rules in my conditional logic to ensure that the second field appears. Any tips will be greatly appreciated. thanks
...
array (
'key' => 'field_51f23f8630b1a',
'label' => 'background image',
'name' => 'background_image',
'type' => 'image',
'instructions' => 'Select an image.',
'save_format' => 'object',
'preview_size' => 'thumbnail',
'library' => 'all',
),
array (
'key' => 'field_5224663a0c8a2',
'label' => 'Opacity for background image',
'name' => 'opacity_for_background_image',
'type' => 'text',
'instructions' => 'slide it to change image opacity {0 = transparent, 10 = opaque}',
'conditional_logic' => array (
'status' => 1,
'rules' => array (
array (
'field' => 'field_51f23f8630b1a',
'operator' => '==',
'value' => '????',
),
),
'allorany' => 'all',
),
'default_value' => 6,
'placeholder' => '',
'prepend' => '',
'append' => '',
'formatting' => 'none',
'maxlength' => '',
), ...
Hi @borisr
Conditional logic only works for toggle fields – these are select / checkbox / radio fields.
Conditional logic can’t be dependent on other fields such as image.
However, I will add this in down the track
Thanks
E
I know the post is almost 4 years old, but are there any plans for this functionality? I’ve needed it several times as well.
Great work Elliot!
The topic ‘image selection and conditional logic’ is closed to new replies.
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.