GetRole
Returns the role of the current form.
Inherited from ApiFormBase.GetRole.
Syntax
expression.GetRole();
expression - A variable that represents an ApiDateForm class.
Parameters
This method doesn't have any parameters.
Returns
string
Example
Read the assigned role of a date form in a document.
// How do I find the role assigned to a date form in a document?
// Display the role to understand the form's purpose within the document structure.
let doc = Api.GetDocument();
let dateForm = Api.CreateDateForm({"key": "Nowadays", "tip": "Enter current date", "required": true, "placeholder": "Your date here", "format": "mm.dd.yyyy", "lang": "en-US"});
let paragraph = doc.GetElement(0);
paragraph.AddElement(dateForm);
let role = dateForm.GetRole();
paragraph = Api.CreateParagraph();
paragraph.AddText("Form role: " + role);
doc.Push(paragraph);