You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/resources/control-flow/user-interactivity/forms/form-actions/set-form-field.md
+32-63Lines changed: 32 additions & 63 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,70 +8,39 @@ sidebar_position: 0
8
8
---
9
9
# Set Form Field [Action]
10
10
11
-
This action allows you to set a value for the Form widgets. For example, you could use this action to auto-populate a form based on a user's previous submission.
12
-
13
-
You could also dynamically update a dropdown menu based on a user's previous selection, such as showing relevant cities based on a selected country.
14
-
15
-
<div style={{
16
-
position: 'relative',
17
-
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
The **Set Form Field** action allows you to programmatically populate or update the value of any input widget—like a TextField, Dropdown, or other form elements—at runtime. This is especially useful when you want to quickly fill or modify user input fields based on user preferences (e.g., saved addresses) or pre-stored information.
40
12
41
-
## Adding Set Form Field action
42
-
43
-
Follow the steps below to add this action to any widget.
44
-
45
-
1. Select the **Widget** (e.g., Button, etc.) on which you want to add the action.
46
-
2. Select **Actions** from the properties panel. If it's the first action, click the **+ Add Action** button. Otherwise, click the "**+**" button below the previous action tile (inside *Action Flow Editor*) and select **Add Action**.
47
-
3. Search the **Set Form Field** (under *State Management*) action and select the widget you would like to set.
48
-
4. Now, you can set its value directly or from a variable.
49
-
50
-
<div style={{
51
-
position: 'relative',
52
-
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
-**Use Saved Address:** If a user toggles "Use Saved Address," you might set the Full Name, Street Address, City, and ZIP Code fields to values pulled from a user profile or database.
16
+
-**Edit Existing Data:** When navigating to an "Edit Profile" page, you can auto-populate the TextFields with the current user info so they only change what’s needed.
17
+
-**Auto select Country/State Dropdown:** Automatically select the user's country and state based on location services or their account settings.
18
+
19
+
:::
20
+
21
+
While adding the Set Form Field action, select the target widget (e.g., `TextField`) and assign a value—this could come from a variable like `fullName` in your backend, app state, or page parameters.
If you need to update several widgets (such as a TextField and a Dropdown), use a separate Set Form Field action for each and specify the appropriate value.
You can also set additional preferences like whether the field should be focused and how the cursor should behave using the **Focus Field When Set** option. When you enable the Focus Field When Set option, it automatically sets the focus on the field once its value is assigned.
32
+
33
+
It is helpful in a scenario like an “Edit Full Name” switch—when turned on, the field preloads the existing name and puts the cursor in place for immediate editing.
34
+
35
+
36
+
When Focus Field When Set is enabled, you can set one of the following **Cursor Position**:
37
+
38
+
-**End**: Places the cursor at the end of the newly filled text, letting the user continue typing from the last character.
39
+
-**Start**: Positions the cursor at the beginning of the text.
40
+
-**Highlight**: Selects (highlights) the entire text, letting the user immediately overwrite it.
41
+
-**Preserve**: Maintains the cursor location as it was, if any—useful if the user was already typing and you only partially changed the text.
0 commit comments