function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ram P 40Ram P 40 

Create a Visualforce page for Contact.I want to display fields FirstName,LastName.Phone,Email. Save and cancel are buttons.I want to fire a validation is LastName not more than 10 characters.more than 10 characters I want to show an error message.

Raj VakatiRaj Vakati
Use this page 
<apex:page sidebar="false" standardController="Contact">

<apex:form>
    <apex:pageBlock title="My Content" mode="edit">
      <apex:pageBlockButtons>
        <apex:commandButton action="{!save}" value="Save"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection title="My Content Section" columns="2">
        <apex:inputField value="{!Contact.FirstName}"/>
        <apex:inputField value="{!Contact.LastName}"/>
        <apex:inputField value="{!Contact.Email}"/>
        <apex:inputField value="{!Contact.Phone}"/>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
  
  
</apex:page>




Use this validation rule

User-added image