Ask AI
Skip to main content

Set invalid message of number input field

Function: Set invalid message of number input field

This action allows you to display a custom error message directly on a Number Input field in your application. This is useful for providing immediate feedback to your users when they enter data that doesn't meet your specific requirements, helping them correct their input quickly. You can also use this action to clear an existing error message.

Input

  • UI element (PART) The specific Number Input field on your form where you want to display or clear an error message. This field is mandatory.
  • Invalid message (STRING) The custom error message you want to display when the input in the field is considered invalid. For example, "Please enter a number between 1 and 100." If you leave this input empty, any existing error message on the specified Number Input field will be removed.

Execution Flow

Real-Life Examples

Example 1: Displaying a specific error for an age field

Imagine you have an "Age" input field, and you want to ensure users enter an age between 18 and 99. If a user enters an invalid age, you can use this action to show a clear error.

  • Inputs:
    • UI element: Age Input Field
    • Invalid message: Please enter an age between 18 and 99.
  • Result: The "Age Input Field" on your form will immediately display the message "Please enter an age between 18 and 99." below it, indicating an error.

Example 2: Clearing an existing error message after correction

A user previously entered an invalid value in a "Quantity" field, and an error message was displayed. After they correct their input, you want to remove the error message.

  • Inputs:
    • UI element: Quantity Input Field
    • Invalid message: \(leave this field empty\)
  • Result: Any error message currently displayed on the "Quantity Input Field" will be removed, indicating that the input is now valid.

Example 3: Setting a dynamic error message based on a calculation

You have a "Discount Percentage" field. If a user enters a value that, when combined with other factors, exceeds a maximum allowed discount (e.g., 50%), you want to show a specific error.

  • Inputs:
    • UI element: Discount Percentage Field
    • Invalid message: The total discount cannot exceed 50%.
  • Result: The "Discount Percentage Field" will show "The total discount cannot exceed 50%." as an error, guiding the user to adjust their input.