How to add a rule in form for a field to match certain value?

I tried honeypot (which was enough on all websites before), also Captcha, still getting spam, probably someone is filling by hand. So I want to add a field, where user would have to answer a question, that only members of that organization would easily know, and if it maches the keyword, then form should be submitted.

What code should I add in rules here?

Something like this?:

$rules = [
            'requiredkeyword'  => ['value' === 'mykeyword'],

i would try ‘in’ with a single value array instead of ‘value’

Match validator should also work

 $rules = [
  'keyword'  => ['required', 'match' => 'mykeyword'],

Thanks, but with both getting errors

that information is a bit thin to help you with more advice?

for in getting this:

and for match this:

Oh, right, match expects a regex pattern :see_no_evil, should be same, not match

Yes, thanks, it works with same, only it considers lowercase/uppercase, which will be a problem here, as some will user lowecase, and some uppercase, and get error with same answer. Can I write both values with uppercase and lowercase, or maybe other rule to ignore it?

Convert to lowercase in the data array

$data = [
  'keyword' => Str::lower(get('keyword')),
  // other fields

Great! All works now, thanks a lot for help :smiling_face: