Set value of number field
Function: Set Value of Number Field
This function allows you to update the value displayed in a specific "Number Input Field" on your application's form. It's useful for pre-filling fields, updating calculations, or responding to user actions by programmatically changing a number.
Input,
- UI element: This is the specific "Number Input Field" component on your form that you want to modify. You'll select this directly from your application's design.
- Answer: This is the numerical value you wish to place into the selected number field. Even though it's a number field, you can provide this value as text (e.g., "123" or "45.67").
Output,
This function does not directly produce an output that you can use in subsequent steps. Its primary effect is to update the specified number field on your form.
Execution Flow,
Real-Life Examples,
Here are some practical ways you can use the "Set Value of Number Field" function:
-
Pre-filling a Quantity in an Order Form:
- Scenario: When a user selects a product, you want to automatically suggest a default quantity of "1" in the quantity field.
- Inputs:
UI element: Select the "Quantity" number input field on your order form.Answer: "1"
- Result: The "Quantity" field on the order form will automatically display "1" when the product is selected.
-
Updating a Score in a Quiz Application:
- Scenario: After a user answers a question correctly, you want to increment their score displayed in a number field.
- Inputs:
UI element: Select the "Current Score" number input field.Answer: "10" (assuming the current score is 0, and you want to set it to 10 for the first correct answer. For subsequent answers, you would first read the current value, add to it, then set the new total.)
- Result: The "Current Score" field will update to show "10".
-
Applying a Discount Percentage:
- Scenario: You have a special promotion, and you want to automatically set a "Discount Percentage" field to "15" when a specific coupon code is entered.
- Inputs:
UI element: Select the "Discount Percentage" number input field.Answer: "15"
- Result: The "Discount Percentage" field on the form will display "15", indicating the applied discount.