Validate panelinput only to lowercase and numbers

Hi,

I have a match validation on a field to validate only to lowercase, numbers and a dash.
But it don’t error the input if I write uppercase in it.

      discountid:
        label: ID
        type: text
        required: true
        validate:
          match: "/[a-z0-9-]+/"

Whats wrong? On https://regex101.com/r/mOmUBf/1 it work as expected.

Cheers

Deleted because it was nonsense.

1 Like

Mmh, that not so nice.
Can I use a own validator on the text field?

This limitation should wrote down in the documentaion.

Hm, what I said above doesn’t seem to be true, if I use a validator like this:

    validate:
      notIn:
        - B
        - C
        - D

it works as well.

And this as well:

    validate:
      match: '/hello/'

So the problem seems to be the double quotes, this works:

    validate:
      match: '/[a-z0-9-]+/'

@JanStieler Let me know if that works for you, then I can change the documentation example.

1 Like

Hi Sonja,
thanks for your effort. No it doesn’t work for me.
Could it be that this is in a structurefield?

Works:

validate:
  match: '/hello/'

Works not:

validate:
      match: '/[a-z0-9-]+/'
 validate:
   notIn:
      - B
      - C
      - D

Hm, I just tested the match validator in structure field and that works for me as well. What is your Kirby version?

I have updated the Kirby version for 5 min from 2.5.2 to 2.5.12.
In this blueprint I use also the Tabs Plugin (https://github.com/afbora/Kirby-Tabs-Field) and the modules.
Here is also my blueprint: https://pastebin.com/F70byjpy

I should test it in a new blueprint with a singlefield.

PS: if you say that it works I believe you :slight_smile: . But thanks for the screenshot .

Well, maybe one of your plugins interferes, I can’t test your example blueprint without installing all those fields. So you should try yourself what might be causing it. I removed modules and the decimal. and idurltomail fields for a quick test, without these it worked.

Okay thanks. I’ll test it tomorrow.
Now I have to meet some friends, the last I have ;).
Nice evening to you and I will inform you tomorrow if some of my plugins are interferes.

Have a nice evening!