Copied!

Build Form Conditional Logic Without Custom Code In Form.io

It’s Like Having An If/Then Statement in Your Form, But Now You Can Build More Complex Form Conditional Logic In Form.io Without Code.

Form Conditional Logic

Updated November 08, 2026

Form conditional logic shows, hides, or changes fields based on what a user has already entered, so a long form only asks for what applies to them. In Form.io you set it per field in the builder’s Conditional tab without writing code, and you can still drop down to JSON Logic or JavaScript when a rule needs it. Here’s when it’s worth adding and how it works.

When You Need Form Conditional Logic (And When You Don’t)

If the app you’re building relies on long, substantial forms with numerous fields, then yes.

Chances are, at some point it’s going to get cumbersome for the user if you don’t start implementing some conditionals.

All form conditional logic does is change how a form appears to users based on selections and inputs they’ve previously entered. It’s the implementation of “If/Then” logic—in a form.

For example, IF I select the choice “food” from a drop box, THEN another drop down box appears with a sample of food selections I can make.

The nice thing about it is that this newly appeared field wasn’t there until the user needed it.

That’s efficient.

Usually.

What do I mean?

Consider a form with a drop down box that has just 2 options. If you choose the first option, nothing special happens, you just made a selection. If you select the second, an additional drop down box appears with three additional selections.

Okay.

In this case, the form designer could have simply put all 4 options in one drop down box and called it a day.

BUT, chances are you’re dealing with a lot of fields and you already know you need this feature—and you don’t want to build the logic from the ground up.

Custom Code: What Building Conditional Logic From Scratch Costs

If you were to build the form conditional logic from scratch, you’re looking at spending a sizeable amount of time writing the code, testing the forms, and fixing bugs. That’s just the nature of them.

Which is why form builders are a thing. With a bit of drag and drop and a few selections, you can build a functional form with some basic conditional logic and you’re good to go. Right?

Theoretically, but there are other prices you must pay if you opt in to using a form builder. So which one do you choose? Good question. I mention a number of things to consider in this post here.

In addition to those considerations, Form.io has always let you implement your own custom JavaScript into the form (using the form builder) so that you were never limited by the available options.

And I’ll be honest, those options used to be pretty limited before, but the feature underwent a significant upgrade in late 2023.

The nice thing about our longstanding custom JavaScript feature is if you still need to deploy custom JavaScript, you can do so in Form.io itself so that it remains in proximity to the form that it modifies.

No need to write a function in your app to handle form conditional logic and then 6 months later try to remember what that function was modifying.

More Conditional Logic With Less Code

So what can you do now that wasn’t possible before?

  • Show/hide fields based on meeting ANY or ALL conditions
  • You can now set multiple and nested conditions to achieve multi-layered logic
  • Conditions can be triggered by a specific value, whether or not a field is empty, and a number of other dynamically loaded options that are relevant to the field component you’re working with

How Does It Work?: Setting Up Conditions in the Conditional Tab

It’s all about showing and hiding fields—yes that’s really the crux of it.

Within the Developer Portal, you can edit most any field and find the Conditional tab at the top:

Form.io component settings with the Conditional tab open
  • Show or Hide this field: Pretty straightforward. The field can be set to be hidden or not at the start and then change its visible state based on what you select—when the conditions are met.
  • When: All conditions are met, or just one that you list?
  • Conditions: The Condition section is the workflow that will execute the settings mentioned above. When the +Add Condition button is clicked, the following fields will be available to configure the condition:
Form.io Add Condition fields: When, Is, and Value
  • When [In the condition]: Lets you select which component (field) in your form will execute the condition.
  • Is: Here you will select from a list of operators that determine what the status of the field value should be before the condition is executed.
  • Value: The data entry of the field to execute the condition. When the conditional field has static values, like the Radio or Select components, those options will be available within a dropdown field to select as the Value.

In the example below, there’s an email field that should only display when a Checkbox is ticked and a certain value of a Radio component is selected. We have added two conditions, one for the checkbox and one for the Radio, to trigger the workflow when both conditions are met: 

Form.io conditional email field shown when a checkbox is ticked and a radio value is selected

Here’s a 2-minute video that demonstrates how to set up form conditional logic:

How Form Conditional Logic Works in Form.io Today

Here’s how the pieces in this post map to the product now, according to Form.io’s docs and feature pages:

  • Simple conditions come first. On the Conditional tab you pick Show or Hide, whether One or All conditions must be met, and then each condition’s field, operator, and value. Operators include Is Equal To, Is Not Equal To, Is Empty, Is Not Empty, and Less Than / Greater Than (with “or equal to” variants). The docs recommend Simple conditions as the primary way to show and hide fields.
  • Advanced conditions use JSON Logic or JavaScript. When a rule depends on several fields at once, you can write it as JSON Logic or as JavaScript that sets show to true or false, referencing fields by their API Property Name. JavaScript conditions need secure evaluation, which adds overhead, so the docs suggest trying a Simple condition first.
  • The Logic tab goes beyond show/hide. A Logic rule pairs a trigger (Simple, JavaScript, JSON Logic, or Event) with actions that change a field’s properties (for example, making it required), set its value, merge in schema changes, or run a custom action.
  • One condition can cover a whole section. Put several fields inside a Layout component and apply the condition to that component instead of to each field. In multi-page wizards, a whole page can be shown or hidden based on earlier answers.
  • Rules live in the form schema. Conditions are stored in the form’s JSON and run wherever the form renders. Hidden fields have their values cleared from the submission by default (the “Clear Value When Hidden” setting), and a hidden field’s Required rule doesn’t block submission. Change a rule in the builder and it takes effect without an app deployment.

Sources: Logic and Conditions (Form.io docs) and Form Conditional Logic and Validation That Runs Everywhere. Keep reading: The Secret-Sauce Elixir of Form.io: The JSON Form, Decoupled Software: The Progress From Hard Mode To Easy Mode, and The Top 5 Non-Obvious Field Components That Eliminate Frustration. Want to try it? Start a free 30-day trial or contact us.

Published by

Form.io Wizard
Content Writer

Long time platform user. Runs multiple production applications with a Form.io backend. "Form.io cleans up all the dirty work and does it for you." Deploy forms like its auth or file storage, stop reinventing the wheel. Forms as the UI, the data model, and the API model. Middleware Mafia.

Published by

Form.io Wizard
Content Writer

Long time platform user. Runs multiple production applications with a Form.io backend. "Form.io cleans up all the dirty work and does it for you." Deploy forms like its auth or file storage, stop reinventing the wheel. Forms as the UI, the data model, and the API model. Middleware Mafia.

LighthouseHQ Case Study: Digital Transformation
Get Answers

Need More Answers?

Ask and we'll get back with you in 1 business day.

Contact Us

Send us a message to contact support or ask a question.

Schedule a meeting

Open Source Platform

Read our FAQ to find out what exactly is Open Source

View the Platform Documentation

View the API Documentation

View the Open Source Code

Learn More

Learn How It Works

Read the Release Notes

Discover Industries that use Form.io

Read our Blog