Skip to main content

SetValidateRange

Sets validate range for field. 💡 Can only be applied to fields with a percentage or number format.

Syntax

expression.SetValidateRange(bGreaterThan, nGreaterThan, bLessThan, nLessThan);

expression - A variable that represents a ApiComboboxField class.

Parameters

NameRequired/OptionalData typeDefaultDescription
bGreaterThanOptionalbooleanfalseIf true, enables minimum value check using nGreaterThan.
nGreaterThanRequirednumberMinimum allowed value (inclusive or exclusive based on implementation).
bLessThanOptionalbooleanfalseIf true, enables maximum value check using nLessThan.
nLessThanRequirednumberMaximum allowed value (inclusive or exclusive based on implementation).

Returns

boolean

Example

Get text field and set validate range for it in a PDF document.

// How to set validate range for a combobox field in a PDF document?

// Set validate range and display the result in a PDF document.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let comboboxField = Api.CreateComboboxField([10, 10, 160, 30]);
page.AddObject(comboboxField);

comboboxField.SetNumberFormat(0, "us", "black-minus", "$", true);
comboboxField.SetValidateRange(true, 0, true, 5);
comboboxField.SetValue('10');