You need to sign in to do that
Don't have an account?
Gallery Integration
Controller Class to Validate duplicate email address in Visualforce page
Hi Everyone,
I have created a simple visualforce page to create a new contact.
However, I want to make a validation to pop out an error message if the email is already existed.
What can I add in the controller class to achieve this?
Here is the code for the visualforce page
Really appreciate for the help
I have created a simple visualforce page to create a new contact.
However, I want to make a validation to pop out an error message if the email is already existed.
What can I add in the controller class to achieve this?
Here is the code for the visualforce page
<apex:page standardController="Contact"> <h1>Registration Page</h1> <apex:form > <apex:pageMessages /> <table> <tr> <th>First Name:</th> <td><apex:inputText value="{Contact.FirstName}"/></td> </tr> <tr> <th>Last Name:</th> <td><apex:inputText value="{!Contact.LastName}"/></td> </tr> <tr> <th>Email Address:</th> <td><apex:inputText value="{!Contact.Email}"/></td> </tr> <tr> <td> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </td> </tr> </table> </apex:form> </apex:page>
Really appreciate for the help
You can do this by writing a simple trigger.
UseCase: The companies' website has a PHP insert, creating Contacts in Salesforce. However, it is possible that the contact already exists in Salesforce. (The current PHP module does not allow for external ids). My solution is to throw a specific error if the Contact email already exists.
Sample Code: Hope this helps.
Kindly mark this as solved if the reply was helpful.
Thanks,
Nagendra
Thanks for your assistance.
Do you have a sample of code on how to use this php insert method?
Is it better to use this method rather than using visualforce page?
Also, If we want to update an information to the contact object, could we use this php method?
Thanks and Regards,
Gallery