Review main Merged

86665[BUGFIX] Report native field validation errors in FormEngine

Ayke Halder CR +2 V +2 Normal +45 −6 updated 11/11/26, 13:24

Commit message

Since FormEngine saves via `requestSubmit()`, the browser's
constraint validation runs before any submit handler. A field
with a natively invalid value, e.g. an invalid address in a
`type="email"` input, silently blocked saving if it was placed
in an inactive tab, as the browser cannot focus it.

FormEngine validation now takes the native validity state of a
field into account, so the field, its label and its tab are
marked as erroneous. This also covers the "bad input" state,
e.g. `1-2` in a number field, which the browser reports as an
empty value while still displaying the input. The `invalid`
event of such fields is intercepted to show the FormEngine
error modal instead.

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 5

Files 4

Review log 3352

Show 1527 earlier messages
  1. Ayke Halder uploaded patch set 1 10/20/24, 16:53

  2. core-ci voted on patch set 1 V +1 10/20/24, 16:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68263

  3. Ayke Halder uploaded patch set 2 V +1 10/20/24, 18:39

  4. core-ci voted on patch set 2 V -1 10/20/24, 18:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68264

  5. Ayke Halder uploaded patch set 3 V -1 10/20/24, 18:58

  6. core-ci voted on patch set 3 V +1 10/20/24, 19:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68265

  7. Ayke Halder uploaded patch set 4 V +1 10/29/24, 19:18

  8. core-ci voted on patch set 4 V +1 10/29/24, 19:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68803

  9. Ayke Halder uploaded patch set 5 V +1 10/30/24, 21:48

  10. core-ci voted on patch set 5 V +1 10/30/24, 21:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68868

  11. Ayke Halder uploaded patch set 6 V +1 10/30/24, 22:17

  12. Ayke Halder rebased onto patch set 7 10/30/24, 22:19

  13. core-ci voted on patch set 6 V -1 10/30/24, 22:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68871

  14. core-ci voted on patch set 7 V -1 10/30/24, 22:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68873

  15. Ayke Halder rebased onto patch set 8 V -1 10/30/24, 22:53

  16. core-ci voted on patch set 8 V +1 10/30/24, 23:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68875

  17. Ayke Halder rebased onto patch set 9 V +1 10/30/24, 23:01

  18. core-ci voted on patch set 9 V +1 10/30/24, 23:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68877

  19. Ayke Halder uploaded patch set 10 V +1 10/31/24, 17:33

  20. core-ci voted on patch set 10 V +1 10/31/24, 17:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68936

  21. Ayke Halder uploaded patch set 11 V +1 11/21/24, 10:51

  22. core-ci voted on patch set 11 V +1 11/21/24, 10:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69918

  23. Andreas Kienast uploaded patch set 12 V +1 11/21/24, 13:03

  24. core-ci voted on patch set 12 V -1 11/21/24, 13:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69942

  25. Ayke Halder commented on patch set 12 11/21/24, 13:23

    ElementsBasicEmailCest.php:109

    The very reason of this change is that this should show a FormEngine validation-error here. Patchset 12 sets this to `'expectError' => false`: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86665/11..12 And `'expectError' => false` fails as expected: See https://git.typo3.org/typo3/CI/cms/-/jobs/3994571 ``` 1) ElementsBasicNumberCest: Simple number fields validation | "Check number field on browser-native va...","number_2",[{"inputValue":"","expectedValue":"","ex...] Test Acceptance/Application/FormEngine/ElementsBasicNumberCest.php:simpleNumberFieldsValidation Step Assert not contains "has-error",["form-control","form-control-clearable","t3js-clearable","has-change","has-error"],"Form field should not be marked as invalid" Fail Form field should not be marked as invalid Failed asserting that an array does not contain 'has-error'. . ``` So this should be set back to the intended `'expectError => true` again.
  26. Ayke Halder commented on patch set 12 11/21/24, 13:27

    ElementsBasicEmailCest.php:109 Reply

    Correct reference: https://git.typo3.org/typo3/CI/cms/-/jobs/3994565 ``` 1) ElementsBasicEmailCest: Email fields validation | "email_1",[{"inputValue":"","expectedValue":"","expectedInternalValue":"","expectError":false},{...] Test Acceptance/Application/FormEngine/ElementsBasicEmailCest.php:emailFieldsValidation Step Assert not contains "has-error",["form-control","form-control-clearable","t3js-clearable","has-change","has-error"],"Form field should not be marked as invalid" Fail Form field should not be marked as invalid Failed asserting that an array does not contain 'has-error'. . ```
  27. Ayke Halder commented on patch set 12 11/21/24, 13:38

    form-engine-validation.ts:204

    One small thing I'd like to change in the end, when everything else in this patch is working: * Replace `let markParent = false;` by `let isValid = true;` here. * Change all usages of `markParent` inside this function. * Finally remove `const isValid = !markParent;` at the end of this function.
  1. Andreas Kienast commented on patch set 12 11/21/24, 13:50

    ElementsBasicEmailCest.php:109 Reply

    The test that bugs me the most is `ElementsBasicNumberCest.php`. For whatever reason, it keeps failing in the last sequence run when it attempts to replace the invalid `1-2` value if a valid empty string value. The screenshots reveal that the field remains invalid. I'll push the current state nevertheless to rule out an issue with seleniarm.
  2. Andreas Kienast uploaded patch set 13 V -1 11/21/24, 13:50

  3. core-ci voted on patch set 13 V -1 11/21/24, 14:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69944

  4. Ayke Halder commented on patch set 13 11/21/24, 14:04

    ElementsBasicEmailCest.php:109 Reply

    Somehow the problem triggered here with `ElementsBasicNumberCest.php` is something that I intended to fix by a separate change: 86842: [BUGFIX] Handle browser-native validation-error `bad input` in form validation | https://review.typo3.org/c/Packages/TYPO3.CMS/+/86842
  5. Andreas Kienast commented on patch set 13 11/21/24, 14:08

    ElementsBasicEmailCest.php:109 Reply

    Confirmed, applying this patch on tops solves the issue! I'll read the patch thoroughly and merge it with this one.
  6. Ayke Halder commented on patch set 13 11/21/24, 14:11

    ElementsBasicEmailCest.php:109 Reply

    My point here is, that Patchset 11 of this patch worked: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86665/11 So I still intend to keep the issues seperate. Can I do a new rebase of this Patchset 11 onto main - and we see if it still works as intended?
  7. Andreas Kienast uploaded patch set 14 V -1 11/21/24, 14:13

  8. Andreas Kienast commented on patch set 14 11/21/24, 14:17

    ElementsBasicEmailCest.php:109 Reply

    Fine for me.
  9. Andreas Kienast uploaded patch set 15 11/21/24, 14:17

  10. core-ci voted on patch set 14 V +1 11/21/24, 14:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69948

  11. core-ci voted on patch set 15 V +1 11/21/24, 14:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69949

  12. Andreas Kienast uploaded patch set 16 V +1 11/21/24, 14:29

  13. Ayke Halder commented on patch set 15 11/21/24, 14:30

    ElementsBasicEmailCest.php:109 Reply

    This looks good again! Patchset 11 and 15 are kind of identical: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86665/11..15 I'll do a rebase for the follow-up issue itself: 86842: [BUGFIX] Handle browser-native validation-error `bad input` in form validation | https://review.typo3.org/c/Packages/TYPO3.CMS/+/86842
  14. core-ci voted on patch set 16 V +1 11/21/24, 14:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69951

  15. Andreas Kienast voted on patch set 16 CR +1 V +1 11/21/24, 14:36

  16. Ayke Halder commented on patch set 16 11/21/24, 14:43

    form-engine-validation.ts:204 Reply

    Done. And thanks for implementing this.
  17. Benni Mack updated the commit message in patch set 17 CR +1 V +1 04/22/26, 06:30

  18. core-ci voted on patch set 17 V -1 04/22/26, 07:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100717

  19. Benni Mack uploaded patch set 18 V -1 11/11/26, 11:50

  20. Benni Mack uploaded patch set 19 11/11/26, 12:33

  21. core-ci voted on patch set 18 V +1 11/11/26, 12:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114067

  22. core-ci voted on patch set 19 V +1 11/11/26, 12:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114071

  23. Benni Mack voted on patch set 19 CR +1 V +1 11/11/26, 12:44

  24. Georg Ringer voted on patch set 19 CR +2 V +2 11/11/26, 12:45

  25. Georg Ringer merged patch set 20 11/11/26, 13:24