-
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 5 years, 4 months ago by
Saravjeet Singh.
-
This discussion was modified 5 years, 1 month ago by
Forcetalks.
-
This discussion was modified 5 years, 1 month ago by
Forcetalks.
-
This discussion was modified 5 years, 4 months ago by
Log In to reply.
Popular Salesforce Blogs

Everything you need to know about Salesforce CRM
Even to this day, certain marketers have the main question that is spinning in their minds being “What is salesforce, precisely?”. Sure, you’ve definitely seen…

What Are The Roles And Responsibility Of A Salesforce Consultant?
Salesforce skills if harnessed properly can open the doors of fortune for you. There are many profiles in Salesforce that you can opt for. One…

An Ultimate Guide to Salesforce Workflow Automation
Workflow automation is the use of software or other technologies to facilitate and streamline complex business processes. Typically, these processes involve a large number of…
Popular Salesforce Videos
Work.com Workplace Command Center Demo
Work.com provides you with essential solutions designed to help businesses reopen the workplace as quickly as possible while helping to keep employees, customers, partners, and…
Learn Apex Triggers Part 2 in Salesforce Development
In this video, we will learn about Apex Triggers in Salesforce development: We'll will be discussing the following things in this video: 1. What are…
Salesforce Apex Rest API Integration | Salesforce Integration
As you know Salesforce is an online cloud solution, we might be required to integrate Salesforce with some other third party tool. We have released…
Popular Salesforce Infographics

How to Create Campaign in Salesforce for Sales Departments: 5 Best Practices
Salesforce Sales Cloud is a powerful platform with several facilities for maintaining and improving the sales function. One of the dominant features offered by Salesforce…

How to Navigate a Successful Salesforce Implementation
There are many ways to navigate a Salesforce implementation. Check out this infographic to learn how to do it successfully.

The 10.5 Commandments of Salesforce Users
This great piece of visual goodness presents the 10 commandments every Salesforce user needs to follow. Make sure every single one of these practices is…