-
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 4 years, 7 months ago by Saravjeet Singh.
- This discussion was modified 4 years, 4 months ago by Forcetalks.
- This discussion was modified 4 years, 4 months ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
Future of Salesforce: Top 6 Predictions
Salesforce is one of the top 10 software skills trending this year. It was the first software of its kind and one of the most…
Integrating Salesforce with Accounting Solutions
With work from home becoming the new normal, companies are leveraging cloud-based technologies to make it easier for teams to access information from multiple devices.…
Forceea: The Enterprise Data Factory We've Been Waiting For | Salesforce
Introduction Everybody needs testing records of SObjects: Developers need testing data for their unit tests. Testers need data for testing. Administrators and architects need data…
Popular Salesforce Videos
How to Compare Change Sets from Another Org ? #Salesforce Change Sets Helper | Salesforce Tutorials
Change set with sort, view all, and additional information, such as last modified date. Allows comparison with other orgs. A chrome extension to improve the…
Marketing Cloud Connect: Syncing Data Back to Sales and Service Cloud
We demo how to expand the capabilities of Marketing Cloud Connect to automatically sync any data from Marketing Cloud over to Sales and Services Cloud.…
Marc Benioff on How Salesforce Was Able To "do well and do good"
Billionaire Marc Benioff is considered a game-changer for activism in the business world. Benioff is the co-CEO, chairman, and co-founder of the cloud computing company…
Popular Salesforce Infographics
How Your Business Can Leverage The Power of Salesforce Community Cloud?
Community Cloud is a cloud-based platform that enables businesses (small, medium, big) to build exceptional and interactive CRM-powered portals, forums, and sites that are faster…
Welcome to the Internet of Customers | Salesforce Infographic
You’ve heard this age-old adage a thousand times: “The customer is always right.” Today more than ever, the customer has countless technologies and practices in…
Why You Should Know About Order to Cash Process - Step by Step | Salesforce Guide
The order-to-cash (O2C) process is a defining part of a company’s success, and it also plays a big role in driving an organization’s relationship with…