Skip to main content

Making a Subform Field Conditionally Required Based on Single Select

This article explains how to make a subform field conditionally required based on a single select field.

When to Use this Feature?

  • Warehouse Management: Require filling in handling instructions depending on whether the goods have been received.

  • Equipment Management: Require adding new accessories based on maintenance needs.

  • Customer Management: Require filling in follow-up plans based on the type of follow-up.

How does it work?

  1. Build a form and include a subform with a single select subfield.

  2. Add a Number subfield in the subform, set its default value to “Formula,” and make it invisible via field permissions.

  3. Use the value of the Number field to define form submission validation rules to achieve the desired conditional requirement.

What does it Look Like?

The overall behavior is as follows :

  1. When the goods are not received and handling instructions are filled:

  2. When the goods are received and handling instructions are not filled:


How to Set it up?

Step1 Creating the form

Create a new form called Warehouse Management with the following fields:

Field Name

Field Type

Settings

Warehouse Selection

Single Select

Required

Person in Charge

Single Line

Required

Contact Number

Number

Required

Goods Handling Details

Subform

Goods ID

Subfield – Number

Required

Goods Received Status

Subfield – Single Select

Custom options

Handling Instructions

Subfield – Single Select

Custom options

Number

Subfield – Number

Default value: Formula
Field permissions: Invisible

Note: The Number subfield is set as invisible because it only serves as a validation field for form submission and does not have practical meaning in the app scenario.

Step 2 Configuring the Formula

  1. Select the Number subfield, go to Field Properties > Initial Value, select Formula > fx Edit:

  2. In the formula editor, enter the following formula for the Number field:

IF(OR(AND(Goods Handling Details.Goods Received Status=='Goods Not Received',ISEMPTY(Goods Handling Details.Handling Instructions)==1), AND(Goods Handling Details.Goods Received Status=='Goods Received', ISEMPTY(Goods Handling Details.Handling Instructions)==0)),0,1)

It means the Number field equals 0 when either of the following conditions is met:

  1. Goods are not received, and handling instructions are empty.

  2. Goods are received, and handling instructions are filled.
    Otherwise, the Number field equals 1.

Step 3 Setting Form Submission Validation

  1. Go to Form Properties > Validations on Form Submission, and click Add Condition:

  2. In the validation rule editor, set the message to display when the condition is not met, and enter the following formula:

SUM(Goods Handling Details.Number) == 0

The formula means the form can only be submitted when the Number field equals 0.

Did this answer your question?