How to set a contact from on front page?

I added contact form in Contacts page by this example, all if fine:

Also would like to have similar/same contact form on front page. In my case front page consists of inner pages (modules), and contact form is displayed in one of them. It’s clear how to display: form is already showing, just need help with settings. Probably need to change something in template? like:
<form method="post" action="<?= $page->url() ?>">

Now after submit page is just reloading.

Where is the logic? If your logic is in the home controller, you have to set your action attribute to that page.

If the form is exactly the same, duplicating the logic on two different pages doesn’t really makes sense.


Yes, forms will be the same.

My front page is using “default.php” template, so I now created /controllers/default.php and looks like controller is working (if form is not validated, I get messages from there).

Only still don’t understand what to write in action="_____", tried different things, like empty, /, <?= $site->url() ?>, but after submit it’s just refreshing.