Restrict Numbers And Special Characters In Visualforce Page Input Field
Sample Code:
<apex:page standardController="Lead" docType="html-5.0"> <apex:form> <apex:pageBlock> <apex:pageBlockSection> <apex:inputField id="firstname" value="{!Lead.FirstName}" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123)" /> <apex:inputField id="lastname" value="{!Lead.LastName}" onkeypress="return (event.charCode > 64 && event.charCode < 91) || (event.charCode > 96 && event.charCode < 123)" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>