Update date field on change

For example automatically setting an end date when a start date is selected

Use this pattern when one field should recalculate related date fields as the user changes a value.

Scenario

This guide uses a duration field to update start and end dates automatically.

Build the form

  1. Add a Form for the Jobs table
  2. Add a number field for the duration
  3. Add a date picker for the start date
  4. Add a date picker for the end date

Add the actions

  1. Add a Validate Form action to the duration field
  2. Add an Update Field Value action that calculates the start date
  3. Add a matching Update Field Value action for the end date
  4. Add a guard so the end date only updates when the start date exists

Use bindings to read the current value and JavaScript to add or subtract days.

Why this works

The user edits one value, and the other dates stay in sync.

App export

Downloads may take a few seconds.


Did this page help you?