I have a field in JSF2, I tried execute a validation in this way:
<h:inputText value="#{manutencaoContratoBean.contrato.nuContrato}" style="text-align: left; width: 90%; ">
<f:convertNumber pattern="#######" maxFractionDigits="0" maxIntegerDigits="16"/>
And thus:
<h:inputText value="#{manutencaoContratoBean.contrato.nuContrato}" style="text-align: left; width: 90%; ">
<f:convertNumber integerOnly="true"/
However, my field only makes a validation and show me a message, I would like just the insertion of numbers, not Strings, this is possible ?
Is possible a insertion only of numbers ? I'm using RichFaces 4, if that's relevant.
I found this, it´s work well:
onkeypress="if(event.which < 48 || event.which > 57) return false;"
But this not allow a click on the backspace button, in case the user make a mistake.
Thanks in advance for all !