Skip to content

[BUGFIX] Do not let untouched invalid values block saving or change on focus - #156

Merged
Kanti merged 2 commits into
test/ve-editable-text-validationfrom
bugfix/untouched-invalid-fields
Nov 9, 2026
Merged

Kanti merged 2 commits into
test/ve-editable-text-validationfrom
bugfix/untouched-invalid-fields

Conversation

@Kanti

@Kanti Kanti commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Problem

The validation of f:render.text works again. Values that violate the TCA, e.g. because the TCA became stricter after they were saved or because they were imported, now cause two problems:

  1. They mark their field invalid on page load and block saving the whole page, including auto save and "save and close", although unchanged fields are not saved at all.
  2. Focusing and leaving such a field without typing normalizes the value: trim, upper, nospace and similar rewrite it, max cuts it, and values shorter than a non-required min are emptied. The record then counts as changed and is saved.

Implemented behavior

  • dataHandlerStore.invalidCount only counts invalid fields with changed data, and focusFirstInvalidField() focuses the first changed invalid field. Unchanged invalid fields still show their validation errors.
  • Leaving a field keeps an untouched value. Changed values are normalized as before.

Tests

  • data-handler-store.test.js: only invalid fields with changed data are counted.
  • ve-editable-text.test.js (browser): untouched values stay unchanged after focus and blur (this test fails without the fix), and a changed value is still normalized.
  • npm run test: 89 passing, npm run lint, grumphp on TYPO3 14

Builds on the browser test setup from "[TASK] Test the validation parsing of ve-editable-text in a browser".

@Kanti
Kanti added this pull request to stack #157 November 9, 2026 12:40
Kanti added 2 commits November 9, 2026 13:49
Values that violate the TCA, e.g. after the TCA became stricter, marked
their field invalid on page load. This blocked saving the whole page,
including auto save and "save and close", although unchanged fields
are not saved at all.

Only changed invalid fields block saving now. Unchanged invalid fields
still show their validation errors.
Leaving a field normalized its value with the TCA rules even if the
editor typed nothing: eval trim, upper, nospace and similar rewrote
the value, values longer than max were cut, and values shorter than
min were emptied. The record then counted as changed and was saved.

An untouched value is kept now. Changed values are normalized as
before.
@Kanti
Kanti force-pushed the bugfix/untouched-invalid-fields branch from e95248a to 95339f7 Compare November 9, 2026 12:50
@Kanti
Kanti marked this pull request as ready for review November 9, 2026 12:56
@Kanti
Kanti merged commit bb49e10 into main Nov 9, 2026
33 checks passed
@Kanti
Kanti deleted the bugfix/untouched-invalid-fields branch November 9, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant