block-lab icon indicating copy to clipboard operation
block-lab copied to clipboard

Field Conditions

Open lukecarbis opened this issue 5 years ago • 5 comments

Depending on the value of another field in the same block, whether a field should be displayed or not.

If field_one is equal to foo then hide field_two.

lukecarbis avatar Apr 11 '19 03:04 lukecarbis

@lukecarbis, just ran into two cases for field conditions:

First use case:

It takes two fields to build a button in my block: a "button-text" field and a "button-url" field. The user keeps entering in "button-text" without "button-url". Ideally, both fields would be required if they are using one of them.

Another use case:

A user can choose between a background image or a background color from a "background" select field in a block. If they choose a background image, the image field should conditionally show. There is no reason for the background image field to show if they chose a color for the background.

bbertucc avatar Jul 16 '19 03:07 bbertucc

Hi there, I'm a web project manager at cultureamp.com and we would really love the ability to use conditional fields. Can you provide an update on the priority and timeline for this issue?

aimeed avatar Oct 18 '19 20:10 aimeed

Question about scope

Hi @lukecarbis, Sorry I missed you yesterday. Could you please help with a question about the scope here?

Depending on the value of another field in the same block, whether a field should be displayed or not.

It sounds like this issue does not include conditions that apply to the entire block, right?

There are already some, like:

condition-block

Some more block-level conditions, like ACF has, might be 'if current user is logged in' or 'page template is default template.'

It sounds like the only conditionals in scope here are field-level. Is that true?

For example, in ACF:

condit-field

Thanks, Luke!

kienstra avatar Nov 18 '19 18:11 kienstra

Yes, only field level. We could consider opening separate issues for other options – but to my knowledge there's been no demand for that level of functionality.

lukecarbis avatar Nov 18 '19 23:11 lukecarbis

Thanks, that sounds great.

kienstra avatar Nov 19 '19 00:11 kienstra