Skip to main content
Version: 1.28 (Current)

Forms 2.0 - Reactive Forms

caution

This page is preliminary and subject to change as Forms 2.0 continues to be developed.

A reactive form responds to the user as they fill it in: a field appears when the user picks an answer, a total updates when a quantity changes, a button is enabled once the required details are there. In Forms 2.0, you get this with short JavaScript expressions on the fields. They run in the browser, straight away, without a request to the server.

What you can make reactive​

ToUseOn the field's settings
Show or hide a fieldReactive Visibility RuleVisibility settings > React to Field Changes
Enable or disable a fieldDynamically Enabled JS Conditional ExpressionEnabled settings > Enable Dynamically
Calculate a field's valueValueField Automations
Run your own code when a value changesOn ChangeField Automations
Run your own code when a field is clickedOn ClickField Automations
Reload a dropdown's items when other fields changeRefresh Data and When Fields ChangeThe Dropdown's data source settings

Visibility and enabled rules are set on any field that supports them, including containers. A rule on a Section or Layout Container shows, hides, enables, or disables everything inside it at once. See Common Field Settings.

Writing expressions​

An expression is a piece of JavaScript. The form's fields are in the form object, by name:

form.Country.value === "United States"

A field inside a Section or Repeater uses its full name, in brackets: form['Billing:Country'].value. In a field inside a Repeater entry, form['Phones:Type'] reads the field in the same entry, so each entry reacts to its own values.

What .value holds depends on the field type:

Field.valueExample
Text Box, Textarea, PasswordTextform.Name.value.trim().length > 0
NumberA number, or emptyform.Quantity.value > 10
DropdownThe selected item's valueform.Country.value === "RO"
DateAn ISO date, yyyy-mm-ddform.Start.value >= "2027-01-01"
MoneyAn object with amount and currencyCodeform.Price.value.amount > 1000
PhoneAn object with countryCode and numberform.Phone.value.countryCode === "US"

The Reactive Visibility Rule and Dynamically Enabled expressions must give true or false. The Value expression gives the field's new value. On Change and On Click are full snippets of code, written in a code editor, that can do more than one thing.

When expressions run​

  • When the form opens, every expression runs once, so the form starts in the right state.
  • When a field it reads changes, the expression runs again. Forms 2.0 tracks which fields each expression reads, so you don't list them anywhere. form.Quantity.value * form.Price.value.amount reruns when either field changes.
  • Self-references are ignored. A Value expression that reads its own field would loop forever, so the form ignores that dependency and shows a message.
  • Errors are logged. If an expression fails, the error is written to the browser console with the field's name, and the rest of the form keeps working.

Examples​

Show a field based on an answer​

The form has an IsBusiness Dropdown with the items Yes and No. On a CompanyName field, check React to Field Changes and set the Reactive Visibility Rule to:

form.IsBusiness.value === "Yes"

Turn on Remove From Layout When Not Visible to close the gap when it's hidden.

Calculate a total​

On a Total field, set Value to:

form.Quantity.value * form.UnitPrice.value

Make Total disabled, with Submit Value When Disabled on, so the user can't edit it but it's still submitted.

Enable a button once the form is filled in​

On a Submit button, check Enable Dynamically and set the expression to the following, where AcceptTerms is a Yes/No dropdown:

form.Email.value.trim() !== "" && form.AcceptTerms.value === "Yes"

A dropdown that depends on another​

For a City dropdown whose items depend on the selected Country, use the Country's value in the City's data source, turn on Refresh Data, and add Country under When Fields Change. The city list reloads each time the country changes. See Dropdown.

Things to keep in mind​

  • The browser isn't a security boundary. A hidden or disabled field can still be changed by a user who knows their way around the browser's developer tools. The server checks the submitted values with the fields' validators, so put rules that must hold in Field Validators or in the button's actions, not only in a visibility or enabled rule.
  • Hidden and disabled fields aren't submitted unless Submit Value When Not Visible or Submit Value When Disabled is on. Fields that aren't submitted have no token in the button's actions.
  • Load-time conditions are different. Visible on Load, Enabled on Load, and Active can use C# conditions with server tokens such as [HasRole:Admins]. They're evaluated once, on the server, when the form opens. The reactive rules can't use server tokens.
  • Need data from the server? Expressions only see the values on the form. To react with data from a database or an API, use a button with a refresh action, such as Refresh Field Data, or a dropdown with Refresh Data.

Last updated: November 18, 2026