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.