SetRequired
Specifies if the current form should be required.
Inherited from ApiFormBase.SetRequired.
Example
Mark a form field as required to enforce completion in a document.
// How do I make a form field mandatory in a document?
// Ensure a field must be filled before the document form is submitted.
let doc = Api.GetDocument();
let textForm = Api.CreateTextForm({"key": "Personal information", "tip": "Enter your first name", "placeholder": "First name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false});
let paragraph = doc.GetElement(0);
paragraph.AddElement(textForm);
textForm.SetRequired(true);
let required = textForm.IsRequired();
paragraph = Api.CreateParagraph();
paragraph.AddText("The first form from this document is required: " + required);
doc.Push(paragraph);