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.