跳到主要内容

GetFormKey

返回当前表单的键。

继承自 ApiFormBase.GetFormKey。

语法​

expression.GetFormKey();

expression - 表示 ApiComboBoxForm 类的变量。

参数​

此方法没有任何参数。

返回值​

string

示例​

读取文档中分配给组合框表单的键。

// How do I retrieve the key of a combo box form in a document?

// Verify that the correct key was set on a combo box by reading it back and displaying it.

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