Would it be possible to have some kind of conditional validation? To make fields required when another fields has been filled.
E.g. We offer a user to show/hide a CTA on the frontend through the CMS. This means that when the copy and URL of that CTA is filled we will display a CTA on the frontend with that custom copy and URL. This means both fields have to be filled out or both have to be left blank.
Currently it looks like this is not possible. Are there any plans to support something like this?
Laravel for example has some nice rules available for this scenario and many others offering full flexibility: required_with, required_with_all, required_if, required_unless (make sure to check out the other validation rules over there as well, they’re solid!)
We do use the plugin but unfortunately that does not solve the validation issue. If we would make all conditional fields required and they are hidden the form can never be saved since it will never pass validation.
That specific issue was discussed in this topic as well, but I would like to have conditional validation in both hidden and visible fields.
Please share any other thoughts you might have, thanks!
+1 on this. It could be implemented just on blocks, perhaps - so the block contains the actual validation logic and can either be inlined or not depending on condition.
I would love to be able to require fields based on whether another field has been filled in. Basically I have places where either field x or field y needs to be completed, but I don’t need both.
To add to this, the Conditional Fields plugin also has UX limitations due to the plugin ecosystem - initial state will most often flicker as the hiding of fields happens after the plugin has had a chance of calling toggleField.
Unsure whether a separate feature request is more appropriate for a first-party conditional-field logic implementation to avoid the flickering clunkiness.
While it’s not exactly the same, it could technically still fulfill this need (with a little more effort — you’d have to write that logic in code, rather than in a nice flow GUI). Do you think that’s similar enough that it could be helpful? If so, it might be worth mentioning this use case in that thread too, so the devs know to consider this need as well.
If you think they’re different enough, no prob. This feature request will remain open regardless. (It’s just that the other one might be released sooner than this one)