Uniform doesn't seem to POST

Hay guys, I hope I can find some helping minds here.
I am working on a landing page: a combo of Kirby 4.8. + Tailwind + AlpineJS, very simple.

I am trying to make a simple contact form, where a user can input Name, Email, Phone, Check an option on a checkbox and write a message before submitting. I don’t seem to find what the problem is / might be and apparently AI doesn’t either, by looking at my code. Maybe I need some real thinkers to help debug.

My form is running in the home.php template which I for testing purposes reduced to the minimum to:

<form action="<?= $page->url() ?>" method="POST">
   <input class="bg-white" name="email" type="email" value="<?php echo $form->old('email'); ?>">
   <textarea class="bg-white" name="message"><?php echo $form->old('message'); ?></textarea>
   <?php echo csrf_field(); ?>
   <?php echo honeypot_field(); ?>
   <input type="submit" value="Submit">
</form>
<?php if ($form->success()): ?>
   Success!
<?php else: ?>
   <?php snippet('uniform/errors', ['form' => $form]); ?>
<?php endif; ?>

To it I have created a controller (site/controllers/home.php), which looks like that:

<?php
dump('Controller Loads');
dump($_POST);

use Uniform\Form;

return function ($kirby) {
   $form = new Form([
      'email' => [
         'rules' => ['required', 'email'],
         'message' => 'Email is required',
      ],
      'message' => [],
   ]);

   if ($kirby->request()->is('POST')) {
      $form->emailAction([
         'to' => 'hello@alessiascuderi.com',
         'from' => 'info@example.com',
      ])->done();
   }

   return compact('form');
};

and my config.php file looks like that:


<?php
return [
  'debug' => true,
      // Canonical Url
  'tobimori.seo.canonicalBase' => 'http://localhost:8888/my-kirby-project/',

  // Site Language 
  'tobimori.seo.lang' => 'de_DE',

  'cache' => [
    'pages' => [
      'active' => false
    ],
    'blocks' => [
      'active' => false
    ],
    'value' => [
      'active' => false
    ],
  ]
];

Now: controller is being dumped. It loads. When submitting I see no dumping of my post request and no error messagere and no mail is sent.

What am I doing wrong here? I can’t seem to figure out where my bug might be!

Thanks for your help!
Alessia

What are those methods? AI hallucinations?

Absolutely yes! Sorry, I have corrected it now with the controller I actually have.
I had pasted a piece randomly “troubleshoot” by AI (which of course also didn’t solve anything.

For local testing, I’d recommend setting up a tool like MailHog or MailPit, see Email testing | Kirby CMS.