-
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, 10 months ago by
Saravjeet Singh.
-
This discussion was modified 6 years, 7 months ago by
Forcetalks.
-
This discussion was modified 6 years, 7 months ago by
Forcetalks.
-
This discussion was modified 6 years, 10 months ago by
Log In to reply.
Popular Salesforce Blogs
Download and Installation of Ant Migration Tool | Salesforce Developer Guide
Introduction The Ant Migration Tool is a Java/Ant-based command-line utility for moving metadata between a local directory and a Salesforce org. Usage of Ant-migration Tool …
7 Signs Your Company Needs a Salesforce Consulting Partner
1. Struggling with Salesforce Adoption One of the most common challenges businesses face is low adoption rates of Salesforce among their teams. Despite its powerful…
The Ultimate Guide to Agentforce: Everything You Need to Know
Imagine having a personal assistant who’s always available and can seamlessly handle various tasks; that’s what Agentforce is. It is like hiring a team of…
Popular Salesforce Videos
Salesforce Security Review | Tutorial Video
If you ever wanted to publish an app, you probably know of the Salesforce security review. While dreaded by many developers, it is far from…
LWC Foundation - Preparing Salesforce Sites
Lightning Web Component Development. Preparing training environment using Salesforce Sites. Watch this video and learn how to prepare Salesforce Sites. If you have any doubts…
Salesforce Integration Crash Course | The Ultimate Guide to Salesforce Integrations
In these 100 minutes, you are going to learn almost all the integration concepts with the help of 2 projects. You will learn about API,…
Popular Salesforce Infographics
7 Key Factors to Keep in Mind When Selecting Salesforce CPQ Software
Today, sales teams are increasingly overwhelmed with complex product offerings and customers’ expectations to deliver quick and personalized experiences. That’s why, sales professionals are inclining…
How Can You Become a Salesforce Admin?
Sometimes a piece of technology seems to be used at every company. Knowing how to use that technology can help a person’s career. It can…
Sales trends and performance: ANZ versus global
Technology is pushing customer expectations to all-time highs and sales organisations into uncharted territory. Organisations worldwide are coping differently as sales trends change operations. Sales…