1

Is there any recommended way to configure 'Required if' Validation in Sitecore Forms?

For example, field A is required if checkbox B is ticked?

At the moment for most form elements I seem limited to optional or mandatory:

enter image description here

Is the answer just to build a custom validator for each input type? I am using Sitecore 9 Update 1

1
  • Hey James, have you been able to implement it?
    – MaksymD
    Jun 26, 2020 at 3:22

1 Answer 1

1

At the moment, that is not possible ootb. So you will need a custom validation. My own blog post could be a start (https://ggullentops.blogspot.com/2017/10/sitecore-9-forms-custom-validation.html) but there is also documentation on the Sitecore docs (https://doc.sitecore.com/developers/91/sitecore-experience-management/en/walkthrough--creating-a-custom-validation.html).

Try to make you validation a bit generic - e.g. add the checkbox B as a parameter so you can reuse the validator on multiple forms..

ps: and if you wrote this conditional validation, sharing it with the community would be appreciated ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.