javascript - How to restrict characters during keypress event in h:inputText -


i need input component accept numbers in [0-9]. have achieved server side conversion/validation:

<h:inputtext ... converter="javax.faces.integer" /> 

however, still allows other characters while entering in ui. how can prevent during keypress event?

<h:inputtext ... converter="javax.faces.integer" onkeypress="...help?" /> 

try this

<h:inputtext id="presentreading" styleclass="labelfont" label="present reading"    converter="javax.faces.integer"value="#{fuelfilling1.presentreading}" maxlength="10">    <f:validatelongrange minimum="1" maximum="10"/> </h:inputtext> 

alternatively, can use jquery or javascript validate on client-side on keypress. okay use jquery?


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -