You need to sign in to do that
Don't have an account?
Rahul Gupta 176
I want to validate the phone field that it should have 10 digits only and last name should have text only so how to use extension .
Not getting way to do it .
Please help
Validation rules on the vf page
<apex:page standardController="Contact" sidebar="false" > <apex:form > <apex:pageBlock title="Edit Contact"> <apex:pageBlockSection columns="1"> <apex:inputField value="{!Contact.FirstName}"/> <apex:inputField value="{!Contact.LastName}"/> <apex:inputField value="{!Contact.Email}"/> <apex:inputField value="{!Contact.Birthdate}"/> <apex:inputField type="number" value="{!Contact.Phone}"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
I want to validate the phone field that it should have 10 digits only and last name should have text only so how to use extension .
Not getting way to do it .
Please help
Use below code. Let me know if this helps :)
Thanks!
Amit Singh
All Answers
Error: Attribute 'type' on component <apex:inputField> in '/apex/newContact' requires HTML docType version 5.0 or higher in newContact at line 21 column 103
Use below code. Let me know if this helps :)
Thanks!
Amit Singh
The above is to just give you an idea of how validation can be used in VF pages for standard controllers. The code can be further improved to your liking.
thanks to others too
Glad to here that it works for you. Sure
Line 11 and 29 are fetching the value of input fields using a unique id as Salesorce generates a unique Id for each component.
For more information please refer below link:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_component.htm
Thanks!
Amit Singh