ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Allow configuring multiple conditions for the same field

Open duncanmcclean opened this issue 1 year ago • 2 comments

Currently, you can only configure one condition for the same field in the blueprint/fieldset builder.

For example: if you configure two conditions like this on the same field, only one of them will actually be saved in the blueprint:

CleanShot 2023-12-13 at 12 32 16

if:
  title: 'equals bar'

It would be nice if you could configure multiple conditions for a single field. Possibly with options whether the conditions should be AND (must be both foo and bar) / OR (must be either foo or bar).

Related: statamic/cms#6008

duncanmcclean avatar Dec 13 '23 12:12 duncanmcclean

You could workaround this by taking advantage of custom JavaScript conditions to check the field's value against multiple values.

duncanmcclean avatar Dec 13 '23 12:12 duncanmcclean

Just posting this here for future me, since I was hacking on this little idea a while back...

Could possibly look into adding && and || operators, so you could do things like: some_field: 'not bar && not foo'

I can get that working pretty easily, but obviously we'd need to think a bit more on the UX in the CP for this kind of thing.

jesseleite avatar May 17 '24 20:05 jesseleite