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
dgindydgindy 

Phone Field Validation

Code:
<apex:page Controller="DoctorContact">
    <apex:form >

       <apex:pageBlock title="New Contact"  mode="Edit" >
                <apex:pageBlockButtons >
                               <apex:commandButton action="{!save}" value="Save"/>
                               <apex:commandButton action="{!Leave}" value="Cancel" immediate="true"/>
                </apex:pageBlockButtons>
        <apex:pageBlockSection title="New Contact" columns="2" >
            <apex:pageBlockSectionItem >
                  <apex:outputLabel value="Name" for="Name"/>
                   <apex:inputfield value="{!DoctorContact.Name}" id="Name"  required="true" />
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                  <apex:outputLabel value="Doctor2" for="doctor"/>
                   <apex:inputfield value="{!DoctorContact.Account__c}" id="doctor"  required="true"  />
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                  <apex:outputLabel value="Phone" for="Phone"/>
                   <apex:inputfield value="{!DoctorContact.Phone__c}" id="Phone"   />
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                  <apex:outputLabel value="Fax" for="Fax"/>
                   <apex:inputfield value="{!DoctorContact.Fax__c}" id="Fax"   />
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                  <apex:outputLabel value="Contact Type" for="ContactType"/>
                   <apex:inputfield value="{!DoctorContact.Contact_Type__c}" id="ContactType"   />
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                  <apex:outputLabel value="Notes" for="Notes"/>
                   <apex:inputfield value="{!DoctorContact.Notes__c}" id="Notes"   />
            </apex:pageBlockSectionItem>
           
            
        </apex:pageBlockSection>
                           
        </apex:pageBlock>
    </apex:form >

</apex:page>

 
 
I have a phone field that needs validation at the save.  The VF page is sending it to the object but it's not be caught and attached to the field on the page.  Example above. How do i connect the validation to the field on my VF page?
MsKnightMsKnight
Try the apex:messages tag. It will create a section on your page where all of the error messages will display. Check out the Component Reference for more detail.