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 posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page