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

Learn All About Objects and Fields in Salesforce | Salesforce Developer Guide
Objects Objects are database tables that allow us to store data and information specific to the organization in Salesforce. We can store data and information…

Salesforce Lookup Relationship and Salesforce Master-Detail Relationship: An Overview
The relationship is used to connect different Objects within org. Salesforce provides the following types of relationships : Lookup relationship Master-Detail relationship Self-relationship External lookup…

Salesforce Tips and Tricks for Data Integration
User experience is one of the most important aspects of any prominent business endeavor. However, to keep your consumers satisfied with your service or product…
Popular Salesforce Videos
BradForce Interview with special guest Jason Jung | Landing Your First Salesforce Job
In this video, I have a great conversation with Jason Jung. Jason landed his first Salesforce Job in the middle of a global pandemic. Listen…
eShopSync for QuickBooks - A Salesforce QuickBooks Connector
One of the best Quickbooks Integration Solution With Salesforce. It efficiently sends QuickBooks data (Categories, Users, Products, and Orders) to Salesforce. For more information, please…
Integrate Salesforce with External System using REST API
In this video, Path to Code explains the following topics: - What is API? - Introduction to REST API - Using cURL to consume Rest…
Popular Salesforce Infographics

How to start your career In Salesforce?
Considering a career in Salesforce is a good choice for IT professionals looking to give a new boost to their career. Salesforce is a new…

Quick Comparison Guide to CRM Systems: Acumatica VS Salesforce Sales Cloud
When you are about to choose, the best and the most appropriate CRM solution for your business, always consider these 3 given points: customization, integration,…

Salesforce Administrator Vs Salesforce Developer – Mainstreams of Salesforce Profession
Salesforce CRM training, an important requisite, can help people enjoy this Salesforce professional sustenance. Salesforce administrators and Salesforce developers are the popular and standard mainstreams…