跳到主要内容

SetPlaceholderText

设置当前表单的占位符文本。

备注

无法为复选框或单选按钮表单设置占位符文本。

继承自 ApiFormBase.SetPlaceholderText。

语法​

expression.SetPlaceholderText(sText);

expression - 表示 ApiComboBoxForm 类的变量。

参数​

名称必需/可选数据类型默认值描述
sText必需string将设置到当前表单的文本。

返回值​

boolean

示例​

在文档中为组合框表单设置占位符文本。

// How do I add placeholder text to a combo box form in a document?

// Guide users on what to select by displaying hint text inside an empty combo box in a document.

let doc = Api.GetDocument();
let comboBoxForm = Api.CreateComboBoxForm({"key": "Personal information", "tip": "Choose your country", "required": true, "editable": false, "autoFit": false, "items": ["Latvia", "USA", "UK"]});
let paragraph = doc.GetElement(0);
paragraph.AddElement(comboBoxForm);
comboBoxForm.SetPlaceholderText("Country");