跳到主要内容

GetPlaceholderText

返回当前表单的占位符文本。

继承自 ApiFormBase.GetPlaceholderText。

语法​

expression.GetPlaceholderText();

expression - 表示 ApiCheckBoxForm 类的变量。

参数​

此方法没有任何参数。

返回值​

string

示例​

读取文档中复选框表单上设置的占位符文本。

// How do I retrieve the placeholder text of a checkbox form in a document?

// Verify the hint text shown inside an unfilled checkbox form before sharing a document.

let doc = Api.GetDocument();
let checkBoxForm = Api.CreateCheckBoxForm({"tip": "Specify your marital status", "required": true, "placeholder": "Marital status", "radio": false});
let paragraph = doc.GetElement(0);
paragraph.AddElement(checkBoxForm);
paragraph.AddText(" Married");
checkBoxForm.SetPlaceholderText("Marital status");
let placeholderText = checkBoxForm.GetPlaceholderText();
paragraph = Api.CreateParagraph();
paragraph.AddText("Placeholder text: " + placeholderText);
doc.Push(paragraph);