Allow previously saved values to validate

Created on 9 December 2021, over 3 years ago
Updated 30 October 2023, over 1 year ago

Problem/Motivation

There are some scenarios where it can be impossible to update old records due to validation errors. This happens wherever "allowed values" are being enforced on a field, but those allowed values change over time. If a value is allowed in the past, and used in a record, but is then removed from the allowed values in the future, the old record will not validate if an update is attempted.

Proposed resolution

The simplest solution seems to be: whenever we determine the allowed values for a field, we should also include previously saved values for the record that is being edited (this would not apply when creating new records).

For example, if the "allowed values" are A, B, and C, but you edit a record that previously had saved a value of D (because it was allowed in the past), then the allowed values for this record should be A, B, C, and D.

Remaining tasks

  1. Investigate all of the fields where this applies.
  2. Figure out a general solution.
  3. Implement.
  4. Add tests.

User interface changes

Include previously saved values in select fields, along with current allowed values.

API changes

Previously saved values will be allowed to validate even when they are not in the list of currently allowed values.

Data model changes

Previously saved values will be allowed to validate even when they are not in the list of currently allowed values.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States m.stenta

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024