SetValueIndexes
Sets selected value indexes.
Syntax
expression.SetValueIndexes(valueIndexes);
expression - A variable that represents a ApiBaseListField class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| valueIndexes | Required | number[] | The indexes of the selected values. |
Returns
boolean
Example
Mark items as selected in a dropdown by their position in a PDF.
// How do I select options by index in a dropdown field in a PDF?
// Choose items from a list using their numeric positions in a PDF.
let doc = Api.GetDocument();
let page = doc.GetPage(0);
let comboboxField = Api.CreateComboboxField([10, 10, 160, 30]);
page.AddObject(comboboxField);
comboboxField.AddOption('Option 1');
comboboxField.AddOption('Option 2');
comboboxField.AddOption('Option 3');
comboboxField.SetValueIndexes([0]);