Form validation: Match value of other form field

I saw there are validators for “match”, but I didn’t really grasp the concept how I would use those in a form controller to check if it “matches” the value of another form field.

What I would like to do is to check whether one form field value matches another form field value, e.g. for password repeats, or in my specific case, to repeat the email address.

Can somebody point me to the clues or can give me an example, how I can submit “match” rules the way they are shown in the cookbook form examples, to the validators?

I’m using the Uniform plugin, but as it’s using the base form and validators of Kirby itself, I guess it doesn’t matter that much.

The Uniform docs have examples for in and between, so using match or any other validator with a value works the same way:

In your example case, you might as well use same rather than match.

Thank you for the hint. That helped to figure it out.

I made it working with same and by manually calling the getter of the field. Thought there might be a more elegant way (natively or with Uniforms) referencing the field directly by name instead of calling the getter, but it works.

'email_repeat' => [
  'rules' => ['required', 'email', 'same' => get('email')],
  'message' => 'Repeating the email is required',