verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
96 stars 72 forks source link

[3.x] Condition "is visible" #2104

Open vandres opened 3 weeks ago

vandres commented 3 weeks ago

What are you trying to do?

Our editors are trying to build some complex conditional forms, which depend on a given zip code. When a zip code is in a certain selection, new field will be displayed. If those fields are selected, again new fields will appear.

If now, for some reason, the user changes the zip code, the first condition is no longer met and the first conditional field disappears. But because the user selected something on that field, the following fields are still visible. To fix that, the fields would need to be moved to a separate page or the complex zip condition would need to be repeated for each field.

Another option, not current implemented, would be to add a visibility condition. So if the the first conditional fields is not visible, all dependent fields would also disappear.

Here are screenshots of the setup:

Bildschirmfoto 2024-10-27 um 15 57 03 Bildschirmfoto 2024-10-27 um 15 57 12 Bildschirmfoto 2024-10-27 um 15 57 22

What's your proposed solution?

Add a new field condition "is visible" and maybe also "not visible" which doesn't react to a data condition, but to a visibilty condition.

Additional context

No response

engram-design commented 3 weeks ago

I'm probably a little hesitant to add something browser-dependent like visibility, but I'll consider it!

vandres commented 3 weeks ago

I mean, visibility could also mean "hidden because of condition"

engram-design commented 3 weeks ago

Yes, I suppose you're right. Just so I'm clear - you'd want a method to be able to essentially say "I want to show this field if this other field is shown/hidden", I think that should be fine, will just need to review things!

vandres commented 3 weeks ago

Yeah, exactly. In our case, one of the conditions changes the visibility of one of the fields. But other fields visibility depends on that field.