Number Input (AI Assistant)
This page provides information on using the Number Input widget (available in AI Assistant Apps), which allows you to capture and validate numeric user inputs.
Content properties
These properties are customizable options present in the property pane of the widget, allowing users to modify the widget according to their preferences.
Type
Data type string
The Data Type property defines the type of input for the widget. For the Number Input widget, the Data Type is set to Number by default. If you change the data type, the widget’s properties and behavior adjust accordingly to match the selected input type.
Options:
- Single-line text: Accepts a single line of text, such as names or titles. Additional text beyond one line is not displayed.
- Multi-line text: Allows multiple lines of text, ideal for longer entries like comments or descriptions.
- Number: Accepts only numeric values.
- Password: Masks input for sensitive information such as passwords or pins.
- Email: Validates and accepts text in email format.
- Phone number: Accepts phone numbers, often formatted with country code and dashes.
- Currency: Accepts numeric input displayed in currency format.
- Date: Accepts date input, with a datepicker for selection.
Data
Value string
Defines the initial value displayed in the widget when it loads. This value serves as the default input until the user modifies it.
Example: To display the price from the selected row in a table:
{{Orders_Table.selectedRow.price}}
Label
The Label property is a group of customizable settings that define the main text displayed on the widget.
Text string
Specifies the text displayed as the label on the widget. This can be used to indicate the purpose or function of the widget.
Validation
The Validation properties ensure that the input provided by users meets specific criteria. These settings allow you to define rules and conditions to validate the data entered into the widget
Required boolean
This validation feature allows you to designate the Input as a mandatory field. For instance, when the Input is placed within a Form widget, enabling the Required property ensures that the Form's submit button remains disabled until the Input has some value.
Regex string
The Regex property, short for Regular Expression, enables you to apply custom validations on user input by defining specific constraints using regular expressions. If the user enters a value that does not adhere to the specified pattern, the widget displays an error message indicating "invalid input"
.
Examples:
//Regex
//Range Validation - 0 to 100:
^(0*100(\.0*)?)$|^([1-9]?[0-9](\.\d*)?)$
//Positive Number Validation:
^[1-9][0-9]*$
//Decimal Number Validation:
^-?\d+(\.\d{2})?$
//Minimum and Maximum Value Validation(1000 and 10,000):
Regex: ^(10000|[1-9][0-9]{3,4})$
Valid boolean
Allows you to define custom validation rules and error messages to guide users when their input doesn't meet required criteria.
For instance, you can use this property to validate a Number Input field, ensuring the value is within a specified range, such as between 10
and 100
.
Example:
{{
NumberInput1.text >= 10 && NumberInput1.text <= 100
}}
Error Message string
Allows customization of the error message displayed when the user enters an incorrect value. By default, the input widget shows a generic "invalid input"
message.
Example: If you want to validate a number input, ensuring the value is within a specified range, such as between 10
and 100
, you can use the following code in the Error message property.
//Valid property
{{NumberInput1.text >= 10 && NumberInput1.text <= 100 ? true : false}}
// Error message property
{{NumberInput1.text < 10 || NumberInput1.text > 100 ? "Error: The number should be between 10 and 100" : ""}}
This ensures that the user is prompted with a custom error message when the number entered is outside the specified range of 10 to 100.
General
General properties are essential configurations that provide overall control over the widget's behavior and appearance.
Tooltip string
Allows you to add a short message or hint that provides additional information to guide the user. A ? icon appears near the label text, and when the user hovers over it, the tooltip message is displayed.