Skip to main content

1. What Is a Subform

An advanced container component that lets you add Text, Numerical, Date, and other components inside it. For example, use a subform when you need to add multiple product entries during product data entry.

2. Use Cases

Subforms are commonly used for data entry scenarios such as outbound orders, inbound orders, and sales orders. Product details in these scenarios can be recorded in a subform, and you can add rows as needed based on the data to enter.
For component attributes, usage, and examples, see this reference.

3. Basic Features

3.1 Layout Mode

Set the layout of the subform. Spreadsheet mode is used by default.

3.1.1 Spreadsheet Mode

Spreadsheet Display effect: Note: Subject and header display are only available on PC when the layout mode is Spreadsheet.

3.1.2 Tiled Mode

Tiled Effect:

3.2 Set the Add Button Name

The Add button is named “Add one” by default. You can customize the name. Example: Set the Add button name

3.3 Set the Delete Button Name

Set the Delete button name

3.4 Maximum Number of Records That Can Be Added

Maximum number of subform records

3.5 Subform Column Width

Column width is customizable, so even long content displays properly. Customize subform column width

3.6 Batch Import

Path: Open a form and you will see a Batch import button under the subform. Click Batch import to proceed. (If the form has public access (silent login) enabled, subforms within the form do not support batch import.) The field order in the subform batch import template matches the field order in the form design. Access page
  • Efficient subform data entry: supports batch import via Excel.
Batch import page After a successful import:

3.7 Batch Export

  • Quickly export subform data:
Batch export Batch export in progress Batch export succeeded

3.8 Export Main Form and Subform Content Together to Excel

  • Supports exporting main form data and subform data together.
  • New export capabilities:
Form page Source records page Excel spreadsheet page

4. Advanced Features

4.1 Action Column

4.1.1 Create an Action Column

After you create an action column, click Edit to bind actions. Action column Effect:

4.1.2 Callback Function

See Action settings. Action - Item-0 Callback function JS panel

4.1.3 Custom Rendering

JSX is supported. Custom rendering - bind action Effect:

5. FAQ

A subform component must retain at least one record.
Configure a Delete action, as shown below:Note: By default, this action deletes all records. Batch deletion by selection is not yet supported.
Use this approach when you want to obtain subform data for form validation or as input parameters for a data source call.Sample code:
Commonly used for cross-app subform data association and for initializing subform data when the form loads.Reference: Detail-to-detail association
Because subform data cannot be displayed, analyzed, or exported on the data management page, display and export subform data in a spreadsheet on the report page instead.Reference: Report analysis on subform data
Add the following code in Custom rendering:
This is a hidden feature. Go to the form’s edit page and enable “Show sort” for the subform. The move up/down buttons then appear, as shown below:
Configure a custom validation function on the component inside the subform, iterate over all records in the subform, and compare them with the current record.
(1) Use one subform component and one Numerical component, and set the Default value of the Numerical component to 1, as shown:(2) Click Subform > Premium > Create action. Create two actions: one for onAddClick and one for onDelClick. Write the code when creating the actions, as shown:The following code can be used directly. Note: Enter the unique identifier of the Numerical component in the first parentheses, and the unique identifier of the subform in the second parentheses. Refer to step (3) for the setup.
(3) First, create an onAddClick action, as shown:Then paste the code above:(4) Create an onDelClick action and paste the same code:Then paste the code above:After clicking Save, the result is:When you delete a newly added record, the count decreases automatically:
(1) Drag in a Numerical component and bind the “onChange” action to it.(2) Copy the following code into the JS panel:
(3) Result:

5.10 A Hidden Component in a Subform Returns Null

When processing a subform, the value of a hidden attribute is reset. It is configured as null, so assigning a hidden-state subform to another subform returns null.
To control the state of a subform component based on the value of a main form field, follow these steps:Create a variable dp2Bind the state of a Single-line text field in the subform to the variable state.dp2Bind an action on the main form Select dropdown to assign the state to variable dp2Sample code:
Bind an action on the main form member component to perform the assignment, as shown below:Sample code:
You cannot insert a subform component inside a subform, but you can add other regular components. The Free plan supports up to 20; other editions support up to 100. Exceeding this limit degrades load performance. We recommend splitting the business logic.

5.11 How Do I Get Subform Data

Use the common component API getValue to get subform data. Sample code:
Response example:

5.12 How Do I Get Subform Row Identifiers

Use the subform API getItems to get the subform row identifiers. Sample code:
Response example:

5.13 How Do I Get the Data of a Specific Row in a Subform

Use the subform API getItemValue to get the data of a specific row in the subform. Sample code:
Response example:

5.14 How Do I Get the Currently Changed Field When a Subform’s onChange Fires

When subform data changes, the subform’s onChange event is triggered not only by cell edits but also by formula calculations, data linkage, or external assignments. To identify the change, use the extra parameter of the subform’s onChange event to get the currently changed field, and the changes parameter to get its value. Sample code:
Result:

5.15 How Do I Update Other Fields in the Current Row When a Component Inside the Subform Changes

Use the subform API updateItemValue to update other fields in the current row of the subform.
Note: This API can only be used in subform component events, not in events of components inside the subform.
Sample code:
Result: After you enter the item name, the value of Item name is assigned to Item name copy in the current row.