You need to sign in to do that
Don't have an account?
Deepak Tiwari 17
how to create contact form apex controller class
Hi There can any one help me how to use custom controller for this code as i use Standard controller....below is the code...
<apex:page StandardController="Contact" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons Location="Top" >
<apex:commandButton action="{!save}" value="Save&New"/>
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="General Information" columns="2" >
<apex:inputField value="{!Contact.FirstName}" taborderhint="1"/>
<apex:inputField value="{!Contact.LastName}" taborderhint="2" required="true"/>
<apex:inputField value="{!Contact.Email}" taborderhint="3" required="true"/>
<apex:inputField value="{!Contact.Phone}" taborderhint="4" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Address Information" columns="2" >
<apex:inputField value="{!Contact.MailingCountry}" taborderhint="5"/>
<apex:inputField value="{!Contact.MailingCity}" taborderhint="6"/>
<apex:inputField value="{!Contact.MailingState}" taborderhint="7"/>
<apex:inputField value="{!Contact.MailingPostalcode}" taborderhint="8" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Industry Information" columns="2">
<apex:inputField value="{!contact.Business_Vertical__c}" required="true"/>
<apex:inputField value="{!contact.Date_Procured__c}" required="true"/>
<apex:inputField value="{!contact.Division_of_Vertical__c}" required="true"/>
<apex:inputField value="{!contact.Area_Of_Division__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Amount Information" Columns="2">
<apex:inputfield value="{!Contact.Amount_Invested__c}" required="true"/>
<apex:inputfield value="{!Contact.Amount_Earned__c}" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockButtons Location="Bottom">
<apex:commandButton action="{!save}" value="Save&New"/>
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="cancel"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:page StandardController="Contact" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons Location="Top" >
<apex:commandButton action="{!save}" value="Save&New"/>
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="General Information" columns="2" >
<apex:inputField value="{!Contact.FirstName}" taborderhint="1"/>
<apex:inputField value="{!Contact.LastName}" taborderhint="2" required="true"/>
<apex:inputField value="{!Contact.Email}" taborderhint="3" required="true"/>
<apex:inputField value="{!Contact.Phone}" taborderhint="4" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Address Information" columns="2" >
<apex:inputField value="{!Contact.MailingCountry}" taborderhint="5"/>
<apex:inputField value="{!Contact.MailingCity}" taborderhint="6"/>
<apex:inputField value="{!Contact.MailingState}" taborderhint="7"/>
<apex:inputField value="{!Contact.MailingPostalcode}" taborderhint="8" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Industry Information" columns="2">
<apex:inputField value="{!contact.Business_Vertical__c}" required="true"/>
<apex:inputField value="{!contact.Date_Procured__c}" required="true"/>
<apex:inputField value="{!contact.Division_of_Vertical__c}" required="true"/>
<apex:inputField value="{!contact.Area_Of_Division__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection title="Amount Information" Columns="2">
<apex:inputfield value="{!Contact.Amount_Invested__c}" required="true"/>
<apex:inputfield value="{!Contact.Amount_Earned__c}" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockButtons Location="Bottom">
<apex:commandButton action="{!save}" value="Save&New"/>
<apex:commandButton action="{!save}" value="Save"/>
<apex:commandButton action="{!cancel}" value="cancel"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
If you need custom controller along with standard controller then you can use 'Extensions' attribute for <apex:page> tag:
So you can write the additional methods in that controller.
Help us explain your whole requirement properly so that we can give you an better solution.
Thanks.
All Answers
You can refer below code and change accordingly.
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
Best Regards
Sandhya
If you need custom controller along with standard controller then you can use 'Extensions' attribute for <apex:page> tag:
So you can write the additional methods in that controller.
Help us explain your whole requirement properly so that we can give you an better solution.
Thanks.
Yo are really helping me... Please help me how can i create multi-select picklist
,
Please help me with this trigger. This is showing error ""Error: Compile Error: Extra ';', at 'Lohia'. at line 8 column 37"".
I want if someone change Stage to Closed won this this opportunity will automatically assigned to Rohit Lohia.
trigger OpportunityTrigger on Opportunity__c (before insert, before update)
{
for(Opportunity opp : trigger.new) {
if(opp.StageName == 'Closed Won' && trigger.oldMap.get(opp.Id).StageName == 'Closed Won')
opp.Assigned_CSD__c = Rohit Lohia;
}
}