You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Conditional fields in CP - contains_any bugs #5293
The problem is with the Regular Expression, it matches any substrings of the conditions.
A solution would be to match only the whole string, e.g., with ^1_image|image_left_text_with_button_right$. This solutions assumes that the contains_any (which in the code is mapped to 'includes_any') is similar to the JS Array.includes(). Anyone attempts to match the substring will eventually fails.
Another, my preferred solution, is to introduce the proper "includes_any" (documented on the website but somehow no option in the drop-down), which behave just like the JavaScripts Array.includes(). This should be a non-breaking change for existing usage.
How to reproduce
Using conditional Field in the Fieldsets.
Have a Select dropdown field with the following options, let's say with handle layout_type:
1_image,
text_left_1_image_right,
image_left_text_with_button_right
Create another field which show only on with the following conditions:
Activity