Number
What is the Form Number?
The number form type is a single-line input that only accepts numeric values from the user. It can optionally strip leading zeros and validate the value against a minimum and maximum.
Options
Minimum value
- Editor label: Minimum value. Property
numberInputMinValue. - The lowest value the input may hold to be considered valid.
- Numeric range: -9000000000000000 to 9000000000000000, step 1. Default: 0.
Maximum value
- Editor label: Maximum value. Property
numberInputMaxValue. - The highest value the input may hold to be considered valid.
- Numeric range: -9000000000000000 to 9000000000000000, step 1. Default: 0.
- See the Validation section for how the default Minimum / Maximum of 0 behaves.
Remove leading zeros
- Editor label: Remove leading zeros. Property
numberInputTrimLeadingZeros. - When enabled, leading zeros are stripped from the value (for example
007becomes7). When disabled, the value is kept as typed. - Values: enabled / disabled. Default: enabled.
Setting Mock Field and Own Value
- Writing only happens in the displayer; in the editor it is disabled.
- On each write the field calls the SDK to set its own value and writes its value to the bound form-output datasource, together with these properties:
minValueandmaxValue. - Writes are not debounced; they happen immediately.
- A write is triggered when:
- The widget is rendered. If an initial datasource value is restored it is validated first; otherwise an empty value is written.
- The input changes (on every keystroke).
- The input loses focus (on blur).
- An external message updates the field.
Validation
- The number field validates the value against the Minimum and Maximum on each input.
- If the value is below the minimum, the field is invalid with the message
Too low value! Minimum value: {min}. - If the value is above the maximum, the field is invalid with the message
Too high value! Maximum value: {max}. - If the value is within range, the field is valid and any error is cleared.
- An empty value clears the validation state and any error.
- The range check only runs when the Maximum value is greater than the Minimum value.
Leaving both Minimum value and Maximum value at their default of 0 does not fully disable the range check. With the defaults, values below 0 or above 10 are treated as invalid, while the message still reports the configured 0. To get meaningful bounds, set an explicit Minimum and Maximum; to switch the range check off, disable Validate Field.
- How the result is surfaced depends on the common Error settings:
- Validate Field must be enabled for the validity to be written to the form summary and for the
{FORM-NAME}-validsensor event to be sent. - Show Validation adds a colored border indicating validity.
- Show error messages displays the error text under the field while the value is invalid.
- Validate Field must be enabled for the validity to be written to the form summary and for the
Sensor Events
The number field can send two sensor events. {FORM-NAME} is the name assigned to the field.
-
{FORM-NAME}- Value: the current field value.
- Triggered each time the field writes to the Mock datasource (render, input change, blur, external message), unless the triggering external command is a silent one.
-
{FORM-NAME}-valid- Value:
trueorfalse, the result of validation. - Triggered only when Validate Field is enabled, after each validation check (debounced 150 ms).
- Value:
External Messages
The number field listens to the basic form commands:
- Set Form: reads the
valueparameter from the message. If it is missing, not a string, or not a number, the message is ignored and the field is left unchanged. Otherwise the value is applied (normalized if Remove leading zeros is enabled), validated, and written to the Mock and own value. - Reset Form / Clear Form: act as a hard reset, emptying the input and updating the validation, Mock, and own value.
- The silent variants (
silentResetForm,silentClearForm) do the same but suppress the value sensor event.
Value from Datasource
The number field does not accept a list of options from a datasource. On render it reads any existing value stored under its field name in the bound form-output datasource and pre-fills the input with it.