SetTag
为当前表单设置标签属性。
语法
expression.SetTag(tag);
expression - 表示 ApiComboBoxForm 类的变量。
参数
| 名称 | 必需/可选 | 数据类型 | 默认值 | 描述 |
|---|---|---|---|---|
| tag | 必需 | string | 将添加到当前容器的标签。 |
返回值
boolean
示例
此示例展示如何设置表单元素的标签。
const doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
const textForm = Api.CreateTextForm({
"key": "Personal information",
"tip": "Enter your first name",
"required": true,
"placeholder": "First name",
"comb": true,
"maxCharacters": 10,
"cellWidth": 3,
"multiLine": false,
"autoFit": false
});
textForm.SetTag('MY_TAG');
paragraph.AddElement(textForm);
const formTag = textForm.GetTag();
paragraph = Api.CreateParagraph();
paragraph.AddText("Form tag: " + formTag);
doc.Push(paragraph);