-
How to Pass the value of Apex:inputField to the extension controller of contact in Salesforce?
Ho to Pass the value of Apex:inputField to the extension controller of contact.
VF Page Code:
<apex:page standardController="Contact" extensions="ReplacementContactController">
<apex:form>
<apex:pageBlock title="Contacts List" id="contacts_list">
<apex:pageBlockSection>
<apex:inputField value="{!Contact.Reason_Inactive__c}" />
<apex:inputField value="{!Contact.Replacement_Contact__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons>
<apex:commandButton value="Save" action="{!SaveAction}"/>
<apex:commandButton value="Cancel" action="{!Cancel}"/></apex:pageBlockButtons>
</apex:pageBlock>
</apex:form></apex:page>Controller code:
public class ReplacementContactController {
public Id cntId;
public String reasonInactive{get;set;}
public Contact contact{get;set;}public ReplacementContactController(ApexPages.StandardController controller) {
cntId = controller.getId();
}public void SaveAction() {
Contact cnt = [SELECT FirstName, LastName, Title, Inactive__c,Reason_Inactive__c FROM Contact where Id =:cntId];
cnt.Inactive__c = True;
update cnt;
}}
***************************************************************
Problem is, I am not bale to pass the selected value for the 2 input fields to the controller
-
This discussion was modified 6 years, 2 months ago by
Saravjeet Singh.
-
This discussion was modified 5 years, 11 months ago by
Forcetalks.
-
This discussion was modified 5 years, 11 months ago by
Forcetalks.
-
This discussion was modified 6 years, 2 months ago by
Log In to reply.
Popular Salesforce Blogs
Salesforce Marketing Cloud Content Builder Can Help You Succeed
Salesforce Marketing Cloud is a robust marketing automation platform that enables firms to drive their marketing activities and convert leads into sales. The Content Builder,…
Sales Cycle in Salesforce - How to Better Manage!
Like a blueprint or an architecture is a must for all to enhance their productivity in Salesforce, we have a sales cycle to follow up the…
Secure Coding Practices for Salesforce Developers
If you have worked on the Salesforce platform for over a few minutes, whether you're a developer or a Salesforce certified admin, you've likely heard…
Popular Salesforce Videos
How to Manage Bulk Data in Salesforce?
Data is at the heart of everything you do in your business. It is also the engine that drives your Salesforce instance. Without it, how…
Understanding Approval Process in Salesforce | How to create an approval process?
In this video, Shrey discussed Approval Process in Salesforce in detail and also he covers the following topics: 1. What is Approval Process? 2. How…
How To Create Global Picklist In Salesforce
Learn how Global Picklist is created in Salesforce. The following points will be covered in this tutorial - 1. Introduction To Global Picklist Global picklist…
Popular Salesforce Infographics
Salesforce Admin Certification Path
The Salesforce Certified Administrator program is designed for individuals who have experience as a Salesforce administrator. The program encompasses the breadth of applications, the features…
Unlock the Potential of Financial Services with Future Trends | Salesforce
The financial services industry is being transformed by emerging technologies like AI, Low-Code, No-Code Solutions, Adoption of the cloud. Discover the various future and trending…
Salesforce Field Service: Power Up Your Field Operations
Salesforce Field Service, commonly known as Field Service Lightning (FSL), is the extension of Service Cloud that provides a unified view of workforce management. In…