Review main Merged

87350[BUGFIX] Include modal-trigger button value in submitted form data

Benjamin Franzke CR +2 V +2 Easy +13 −17 updated 12/09/24, 14:56

Commit message

An intercepted (via confirm modal) form submit button with a name and
value attribute is now included in the form-payload by requesting the
submit with the button as context instead of manually submitting the
form without trigger-button context.

This ensures that button values are actually submitted and can be used
to carry relevant payload. The site configuration overview is
adapted to make use of this by removing unnecessarily duplicated forms.

Codewise we now make use of the read-only `form` property of HTML
elements that are associated to a form (either implicitly via nesting
or explicit via `form=""` attribute) to avoid manual DOM lookups, see:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/form

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Andreas Kienast +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 3

Review log 1013

  1. Benjamin Franzke uploaded patch set 1 12/04/24, 10:04

  2. Benjamin Franzke uploaded patch set 2 12/04/24, 10:08

  3. Benjamin Franzke uploaded patch set 3 12/04/24, 10:09

  4. core-ci voted on patch set 3 V +1 12/04/24, 10:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70578

  5. Benjamin Franzke uploaded patch set 4 V +1 12/04/24, 10:36

  6. core-ci voted on patch set 4 V +1 12/04/24, 10:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70579

  7. Benjamin Franzke updated the commit message in patch set 5 V +1 12/05/24, 09:05

  8. core-ci voted on patch set 5 V +1 12/05/24, 09:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/70629

  9. Andreas Kienast voted on patch set 5 CR +1 V +1 12/05/24, 10:06

  10. Oliver Hader voted on patch set 5 CR +1 V +1 12/09/24, 14:29

  11. Oliver Hader commented on patch set 5 12/09/24, 14:42

    modal.ts:550

    There's one difference to the previous behavior (switching from `submit` to `requestSubmit`): Example: ``` <form id="example"> <input type="email" value="" required name="email"> </form> ``` Calling `requestSubmit` on the form would not trigger any request (since the validation fails). However, `submit` would have been processed. However, I think thats fine - maybe even better, to have the form validity checked as well.
  12. Benjamin Franzke commented on patch set 5 CR +2 V +2 12/09/24, 14:56

    modal.ts:550 Reply

    ack I also think this is fine. I actually didn't mention this difference because we do not use modal-confirmation-buttons on form's with form validations, but yes, using `requestSubmit()` would be fine in this case and if this is ever used with form validations the user can click again and then requestSubmit will run again. Hope it's fine to mark this as resolved. Thanks for checking!
  13. Benjamin Franzke merged patch set 6 12/09/24, 14:56