Validation in array not working

I’m sure I missed something stupid here…

In my blueprint I have a number field and I want users to be able to select only 2, 3, 4 or 6 :

   client_perrow:
    label: Images per row on large screens
    type: number
    icon: ellipsis-h
    help: Select a number (2, 3, 4 or 6)
    default: 4
    validate:
        in:
            -2
            -3
            -4
            -6
    width: 1/2 

This returns an error when selecting for example 5… All good!
But unfortunately it also gives an error when selecting any of the good values.

What am I missing?

PS: I’ve tried the array with and without spaces. I based this on https://getkirby.com/docs/cheatsheet/validators/in

Just tested this and found it works if you wrap the numbers in quotes and leave a space between the bullet and the number.

1 Like

Beautiful! Thanks a lot @texnixe
I was starting to look at the match validation but working with regex is a nightmare for me :sweat_smile:

I find this site really helpful: http://regexr.com

Haha I was on that site when ou posted your reply :wink:

Using in is much more efficient here, but in case you want to use a RegEx: That’s as simple as "/^[2346]$/". It will match exactly one character and that has to be one of the valid numbers. :slight_smile:

1 Like

Couldn’t have been simpler!