GetRole
返回当前表单的角色。
继承自 ApiFormBase.GetRole。
语法
expression.GetRole();
expression - 表示 ApiCheckBoxForm 类的变量。
参数
此方法没有任何参数。
返回值
string
示例
读取文档中分配给复选框表单的角色。
// How do I find out the role of a checkbox form in a document?
// Determine the purpose or permission level of a checkbox form field before processing it in a document.
let doc = Api.GetDocument();
let checkBoxForm = Api.CreateCheckBoxForm({"tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": false});
checkBoxForm.SetFormKey("Marital status 1");
let paragraph = doc.GetElement(0);
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" Married");
paragraph.AddLineBreak();
checkBoxForm = Api.CreateCheckBoxForm({"tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": false});
checkBoxForm.SetFormKey("Marital status 2");
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" Single");
let role = checkBoxForm.GetRole();
paragraph = Api.CreateParagraph();
paragraph.AddText("Form role: " + role);
doc.Push(paragraph);