Review main Merged

72998[TASK] Allow submitting forms via Modals

Oli Bartsch CR +2 V +2 Easy +29 −10 updated 01/14/22, 20:00

Commit message

Our Modal implementation already provides a couple
of actions, executed when the modal is confirmed.

However, previously it was not possible to submit
a form - execute a POST request. All available
options (e.g. "href" or "data-uri") always executed
a GET request.

To improve the Modal, especially for operations,
e.g. "delete", which should always be executed
via POST, the Modal component is extended for
corresponding functionality.

Therefore, the Modal does now automatically
submits the closest form (if one exists), in
case the trigger has type=submit set. In case
a button with type=submit is the trigger but is
not inside a form element, the "form" attribute
can be used on the button, to submit an arbitrary
form in the current document.

Alternatively, it's also possible to set the
"data-target-form" attribute on the trigger
element, which does not have to be a button,
to an arbitrary form identifier in the current
document.

The new functionality is added at the end to
prevent any side effect for existing functionality.

As demo, the ext:sys_note "Delete this note" button
is adapted to execute POST requests to delete a note.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 914

  1. Oli Bartsch uploaded patch set 1 01/12/22, 13:30

  2. core-ci voted on patch set 1 V +1 01/12/22, 13:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21972

  3. Oli Bartsch uploaded patch set 2 01/12/22, 14:32

  4. core-ci voted on patch set 2 V +1 01/12/22, 14:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21977

  5. Oli Bartsch updated the commit message in patch set 3 01/12/22, 23:57

  6. core-ci voted on patch set 3 V +1 01/13/22, 00:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22002

  7. Christian Kuhn commented on patch set 3 01/13/22, 20:56

    I'd love to combine this patch with a demo, but will then need a pre-patch a sys_note event ... stay tuned.
  8. Christian Kuhn uploaded patch set 4 01/14/22, 14:42

  9. core-ci voted on patch set 4 V +1 01/14/22, 14:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22068

  10. Christian Kuhn uploaded patch set 5 01/14/22, 19:23

  11. Stefan Bürk voted on patch set 5 V +1 CR +1 01/14/22, 19:35

  12. core-ci voted on patch set 5 V +1 01/14/22, 19:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22089

  13. Christian Kuhn voted on patch set 5 V +2 CR +2 01/14/22, 20:00

  14. Christian Kuhn merged patch set 6 01/14/22, 20:00