Using the suggestions from the following post, I made a custom validation for a checkbox list on a form using the Sitecore Forms Builder. However, when I click the checkbox I get the error message ("click the checkbox!") and I cannot submit the form despite the checkbox being checked.

The form is using a checkbox list and is set to required. I've been having an issue that despite the checkbox being checked, and when submitting the form, Sitecore thinks that the checkbox has not been checked no matter what I do.

In the validations I have the following:

Type: Sitecore.ExperienceForms.Mvc.Models.Validation.RegularExpressionValidation,Sitecore.ExperienceForms.Mvc

Message: Check the field!

Parameters: {"regularExpression":"^/on$/"} (I also tried with true)

The checkbox list is set to required on the form.

I have set my checkbox list option to use this custom validator as well and ensure it was set on my form.

1 Answer 1


I have faced similar issue where my regex wasnt working as expected in custom validator. For now you can try recreating same validator in your solution just to debug and then see if all parameters are received as expected.

In my case, regex wasn't populated in the expected property. So I made change in code a bit like this,

//Sitecore namespace - Sitecore.ExperienceForms.Mvc.Models.Validation
    public class CustomRegularExpressionValidation : ValidationElement<RegularExpressionParameters>
    public override void Initialize(object validationModel)
          if (validationModel is StringInputViewModel stringInputViewModel)
            this.Title = stringInputViewModel.Title;
          // This was not evaluating as expected      
          //this.RegularExpression = this.Parameters?.RegularExpression ?? string.Empty;
          // so added this
          this.RegularExpression = this.ValidationItem.Parameters ?? string.Empty; 

Regex not working in Sitecore Forms

Hope this helps !!

Your Answer

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

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