Skip to main content

Home > blockly > FieldNumber > setConstraints

FieldNumber.setConstraints() method

Set the maximum, minimum and precision constraints on this field. Any of these properties may be undefined or NaN to be disabled. Setting precision (usually a power of 10) enforces a minimum step between values. That is, the user's value will rounded to the closest multiple of precision. The least significant digit place is inferred from the precision. Integers values can be enforces by choosing an integer precision.

Signature:

setConstraints(min: number | string | undefined | null, max: number | string | undefined | null, precision: number | string | undefined | null): void;

Parameters

ParameterTypeDescription
minnumber | string | undefined | nullMinimum value.
maxnumber | string | undefined | nullMaximum value.
precisionnumber | string | undefined | nullPrecision for value.

Returns:

void