Set value of input field
Function: Set value of input field
This action allows you to programmatically set or change the value displayed in a specific input field on your form. This is useful for pre-filling fields, updating user input based on other actions, or clearing a field.
Input
- UI element (Type: UI element, specifically an input field) The specific input field on your form whose value you want to change. This is a required input.
- Answer (Type: Text) The new text or value you want to place into the selected input field. If you leave this empty, the input field will be cleared.
Output
This action does not produce any direct output variables. It modifies the state of the specified UI element within your application.
Execution Flow
Real-Life Examples
Here are some practical ways you can use the "Set value of input field" action:
Example 1: Pre-filling a form field with user data
Imagine you have a user profile form. After a user logs in, you want to automatically fill their email address into an input field.
- Inputs:
- UI element: "Email Address Input Field" (the input field on your form)
- Answer: "[email protected]" (retrieved from the logged-in user's data)
- Result: The "Email Address Input Field" on the form will automatically display "[email protected]", saving the user from typing it.
Example 2: Clearing a search field after a search is performed
After a user submits a search query, you might want to clear the search input field to indicate that the previous search is complete and the field is ready for a new query.
- Inputs:
- UI element: "Search Query Input Field" (the input field where users type their search terms)
- Answer: (Leave this field empty)
- Result: The "Search Query Input Field" on the form will be cleared, showing no text, and ready for the next search.
Example 3: Updating a calculated total in a shopping cart
In an e-commerce application, if a user changes the quantity of an item, another action might calculate the new total price. You can then use this action to display the updated total in a dedicated input field.
- Inputs:
- UI element: "Order Total Display Field" (an input field showing the total cost)
- Answer: "150.75" (this value would come from a previous calculation action)
- Result: The "Order Total Display Field" on the form will instantly update to show "150.75", reflecting the new calculated total.