Reputation: 141
I have a jsf problem: I want to an "inputText" to be only a numeric. For this I use but it does not work.
When I fill the field with a word (for instance), no error message appears.
Here is my xhtml code:
<h:form id="profil">
<p:inputText value="#{effectifBean.efCadre}"
validatorMessage="#{messages['content.msg']}" >
<f:validateRegex pattern="[1-9]*" />
</p:inputText>
</h:form>
Anyone have an idea ?
Thank you for your help.
Upvotes: 0
Views: 204
Reputation: 1846
why you not use inputMask if you know the number of char inside input ?
<p:inputMask value="#{effectifBean.efCadre}" mask="99999"/>
Upvotes: 2