2
votes

When I use PrimeFaces keyfilter with regexp /[0-9]/ when I test in my application I saw that I can put values like ! " # $ % &, other values like * { or A-Z are not allowed

My code is like this:

<p:inputText maxlength="5" value="#{myController.inputValue}" >
    <p:keyFilter regEx="/[0-9]/" preventPaste="false" />
</p:inputText>

Note: This affects Firefox but works well in Chrome.

1
[0-9] has nothing to do with those punctuations. But if the filter is chars that are not [0-9] then it does. Will it let digits in the field ? Otherwise, it's a usage problem that you don't give enough information about. - user557597
Hi, why only an answer to part of the commemt? - Kukeltje
I can confirm this using Firefox with PF7.0 and 7.1-SNAPSHOT. It works as expected using Chrome. - Selaron
It now has a number: #5110 - Selaron
@Selaron: thanks. Reminds me of not forgetting to ask posters to try different browsers. Why not create an answer? - Kukeltje

1 Answers

3
votes

Issue: https://github.com/primefaces/primefaces/issues/5110

PR Submitted: https://github.com/primefaces/primefaces/pull/5111

This will be fixed for PF 7.1.

As a note I documented how the problem was introduced here: https://github.com/akzhan/jquery-keyfilter/issues/16

Thanks for reporting this issue!