Set Form Values
The Set Form Values setting allows you to simultaneously set values for multiple input fields within a form. This feature is particularly useful for pre-populating forms with existing information or dynamically updating multiple fields at once.
How Does It Work?
Select the Form: In the Wized elements panel, click on the form that contains the input fields you wish to modify.
Apply the Set Form Values Setting: Navigate to the "Settings" tab in the properties panel and select the Set Form Values action.
Define Values in the Function Editor: Use the Function Editor to specify the values to be set in the form fields. Return an object where the keys correspond to the names of the input fields (as defined in Webflow), and the values are the new values you want to assign.
javascriptreturn { name: r.get_user.data.name || '', email: r.get_user.data.email || '', age: r.get_user.data.age || '', };
Add Conditions (Optional): If you want to update the form values only under specific conditions, you can include a conditional statement in the Function Editor.
Important Considerations
Data Format: Ensure that the values you provide in the object match the expected data types of each input field. For instance, if a field is of type "number," you must provide a numeric value.
Field Names: The keys in the object must exactly match the names of the input fields in your Webflow form.