Set Input Value
The "Set Input Value" configuration allows you to dynamically and automatically set the value of an input field. You can pre-fill forms, display search results, or any other interaction that requires updating the value of an input.
How it works
Select the input: In the Wized element panel, click on the input field you want to configure.
Apply the Set Input Value configuration: In the "Settings" tab of the properties panel, select Set Input Value.
Define the value in the Function Editor: Use the Function Editor to specify the value you want to set in the input field. You can use any data available in Wized, such as variables, cookies, API responses, or even the value of other inputs. For example, the code in the Function Editor would look like this:
javascriptreturn 'desired value'; // Sets the desired value in the input field
Add conditions (optional): If you want the input's value to be updated only under certain circumstances, you can add a condition in the Function Editor.
Practical Examples
- Pre-filling forms: If you have user information stored in cookies or variables, or your DB, you can use "Set Input Value" to pre-fill form fields.
- Displaying search results: When performing a search, this function can be used to show the search terms within an input field. This allows you to edit or refine your queries.
- Updating input fields based on other values: You can use conditional logic in the Function Editor to update the value of an input based on other data from your application.