GetFormsByTag
function GetFormsByTag(sTag: string = null): ApiBlockLvlSdt[] | ApiInlineLvlSdt[]
Description
Returns a list of all forms in the document with the specified tag name.
Parameters
- sTag
string
null Form tag.
Returns
ApiBlockLvlSdt[] | ApiInlineLvlSdt[]
Try It
var oDocument = Api.GetDocument();
var oTextForm = Api.CreateTextForm({"key": "FirstName", "tip": "Enter your first name", "tag": "form_1", "required": true, "placeholder": "First name", "comb": true, "maxCharacters": 10, "cellWidth": 3, "multiLine": false, "autoFit": false});
var oParagraph = oDocument.GetElement(0);
oParagraph.AddElement(oTextForm);
var oComboBoxForm = Api.CreateComboBoxForm({"key": "Country", "tip": "Choose your country", "tag": "form_1", "required": true, "placeholder": "Country", "editable": false, "autoFit": false, "items": ["Latvia", "USA", "UK"]});
oParagraph.AddLineBreak();
oParagraph.AddElement(oComboBoxForm);
var aForms = oDocument.GetFormsByTag("form_1");
aForms[0].SetText("John Smith");
aForms[1].SelectListValue("USA");