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
Post a Comment