Track form submit as Outlinks

Hello, on one of my website instead links <a> is a <form action="https://external.com/xyz"> with <intput type="submit"> in use, that send POST Data. This sumbit should be tracked as Outlinks. Is this possible? Further, is it possible to attach the POST Data into the link like https://external.com/xyz - 123?

There are few Topics in the internet, that have this matter included, but not really a solution, or a misleading solution.

It must be used a onsubmit() instead a onclick Event.
It must be used a

_paq.push(['trackLink', url, 'link']); // 'link' or 'download'

The url must not be a textstring, but a URL-Object. That is realizable with new URL() .
Also put both in a function and call it with a onsubmit().

First the function (in the HTML <head>):

function form_link_tracking(form_element) {

	var form_action = form_element.action;
	// here is it possible to expand the Url-string like:
	// var post_value = form_element.children[0].value;
	// form_action = form_action + '/POST/' + post_value;
	var form_action_url = new URL(form_action);
	
	_paq.push(['trackLink', form_action_url, 'link']);
}

Second the form (in the HTML <body>):

<form action="https://example.com/xyz" method="post" onsubmit="form_link_tracking(this);">
<input type="text" name="xyz" value="">
<input name="xyz_submit" type="submit" value="Submit">
</form>

It works also with disabled link-tracking

// _paq.push(['enableLinkTracking']);

When you make all right, it works fine.

Reference: https://developer.matomo.org/api-reference/tracking-javascript