Have you tried like
chkbox.Validators = typeof(EPiServer.Forms.Implementation.Validation.RequiredValidator).FullName;
The following article is very useful in creating a form using API
I have a page type which automatically creates an Episerver form including multiple form elements and includes it in a ContentArea. Smooth sailing so far. But when I try to make one of these generated fields required by default nothing quite seems to work.
I have tried variations of the following...
This does make the field required in the CMS view. But on the rendered view, even if the user has checked the checkbox it still spits out the "This field is required" message.
I can find little documentation on the subject and it'd be great to hear if someone has had similiar problems and any potential steps taken to solve it?
This is how the EPiServer.Forms.Implementation.Elements.BaseClass.ValidateableElementBlockBase.Validators property is documented. Presumably this string can be set manually when generating the form, but the format in which it should be structured is completely foreign to me.