Homepage
KeyFilter
KeyFilter can be used to filter keyboard input on specified input components. Below is also a list with predefined masks and their regular expressions.
KeyFilter with mask 'num' on a p:inputText (only digits)
KeyFilter with regEx /[ABC]/i on a h:inputText
KeyFilter with testFunction on a p:autoComplete

pint /[\d]/
int /[\d\-]/
pnum /[\d\.]/
money /[\d\.\s,]
num /[\d\-\.]/
hex /[0-9a-f]/i
email /[a-z0-9_\.\-@]/i
alpha /[a-z_]/i
alphanum /[a-z0-9_]/i
Source
<h:panelGrid columns="1" columnClasses="formColumn">
    <h:outputText value="KeyFilter with mask on a p:inputText"/>
    <p:inputText id="text1" required="true" style="margin-bottom: 10px;"/>
    <h:outputText value="KeyFilter with regEx on a h:inputText"/>
    <h:inputText id="text2" style="margin-bottom: 10px;">
        <pe:keyFilter regEx="/[ABC]/i"/>
    </h:inputText>
    <h:outputText value="KeyFilter with testFunction on a p:autoComplete"/>
    <p:autoComplete id="autoComplete1" value="#{autoCompleteController.text}"
                    completeMethod="#{autoCompleteController.complete}" style="margin-bottom: 10px;"/>
</h:panelGrid>

<pe:keyFilter for="text1" mask="num"/>
<pe:keyFilter for="autoComplete1" testFunction="return c == 'z';"/>
            
Components and more
Use Cases
Documentation pe:keyFilter
Attributes (move mouse over the names to see data types)
Name Description
idUnique identifier of the component in a namingContainer.
rendered Boolean value to specify the rendering of the component, when set to false component will not be rendered.
bindingAn EL expression referring to a server side UIComponent instance in a backing bean.
widgetVarName of the client side widget.
forThe target input.
regExDefines the regular expression which should be used for filtering the input.
inputRegExDefines the regular expression which should be used to test the complete input.
mask Defines the predefined mask which should be used (pint, int, pnum, num, hex, email, alpha, alphanum).
testFunctionDefines a javascript code or function which should be used for filtering.
preventPaste Boolean value to specify if the component also should prevent paste. Default value is true.
PrimeFaces Extensions Showcase - © 2011-2014, PrimeFaces: 5.2, PrimeFaces Extensions: 4.0.0-SNAPSHOT, JSF: mojarra 2.2.8, Server: Apache Tomcat/7.0.54, Build time: 2015-08-22 09:03
Theme
afterdark
afternoon
afterwork
aristo
black-tie
blitzer
bluesky
bootstrap
casablanca
cruze
cupertino
dark-hive
delta
dot-luv
eggplant
excite-bike
flick
glass-x
home
hot-sneaks
humanity
le-frog
midnight
mint-choc
overcast
pepper-grinder
redmond
rocket
sam
smoothness
south-street
start
sunny
swanky-purse
trontastic
ui-darkness
ui-lightness
vader
occured!
Message:
Timestamp:
StackTrace:
Developers
Thomas Andraschko andraschko.thomas@gmail.com
Oleg Varaksin ovaraksin@googlemail.com
Nilesh Namdeo Mali nileshmali86@gmail.com
Mauricio Fenoglio fenoglio.mauricio@gmail.com
Pavol Slaný pavol.slany@gmail.com
Sudheer Jonna sudheer.jonna@gmail.com