Uniform webhookAction based on selected field value

Hey, I use Uniform and have a select field there. Now I want to use the input to either send an email with $form->emailAction or execute $form->webhookAction.

What exactly is you problem. In your controller, check the value and then conditionally either call the email action or the webhook action in an if statement

This is my code inside the controller. I think my if function is not right.

<?php

use Uniform\Form;

return function ($kirby)
{
    $form = new Form([
        'firstname' => [
            'rules' => ['required'],
            'message' => 'Please enter your name',
        ],
        'lastname' => [
            'rules' => ['required'],
            'message' => 'Please enter your name',
        ],
        'email' => [
            'rules' => ['required', 'email'],
            'message' => 'Please enter a valid email address',
        ],
        'telephone' => [],
        'category' => [
            'rules' => ['required', 'in' => [['Complete', 'Vegan']]],
        ],
        'tracking' => [
            'rules' => ['required'],
            'message' => "Please choose 'yes' or 'no'",
        ],
        'message' => [],
    ]);
    if ($kirby->request()->is('POST')) {
        $form->honeypotGuard(['field' => 'website']);
        $form->honeytimeGuard([
            'key' => c::get('uniform.honeytime.key'),
        ]);
        if (get('category') === 'vegan') {
            $form->emailAction([
                'to' => 'xxxx@xxxx.de',
                'from' => 'xxxx@xxxx.de',
                'subject' => 'New Message',
                'replyTo' => $form->data('email'),
            ])
                ->logAction([
                    'file' => $kirby->roots()->site() . '/contact.log',
                ]);
        }
    }

    return compact('form');
};

And where is the webhook action? I’d expect an else here for the webhook action…

On a side note:

Here you require one of the values Complete or Vegan.

Here you compare with the category value vegan with a lower case v.