Skip to main content

GetFormKey

Returns the current form key.

Inherited from ApiFormBase.GetFormKey.

Syntax​

expression.GetFormKey();

expression - A variable that represents an ApiComboBoxForm class.

Parameters​

This method doesn't have any parameters.

Returns​

string

Example​

Read the key assigned to a combo box form in a document.

// 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);