Only Number enter in Input text on VF page


Using javascript you can validate only number will be enter in text box

<apex:page>

<script>
   function numbersonly(e)
        { 
            var unicode=e.charCode? e.charCode : e.keyCode;   
            if (unicode!=8 )
            { 
                if ((unicode<48||unicode>57))   
                    return false; 
               
            }
         
        }
        
        
    </script>

<apex:form>

<apex:inputText value="{!xxx}" onkeypress="return numbersonly(event);">

</apex:form>
<apex:page>


  Sumit Shukla
sumitshukla.mca@gmail.com
skypeID: shuklasumit1
Mob:9711055997

Comments

Popular Post

Copy Billing Address to Shipping Address on VF Page Using JavaScript

How to use Comparable Interface in Salesforce

Get list of Key Prefix of Sobject in Salesforce