-
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, 6 months ago by Saravjeet Singh.
- This discussion was modified 4 years, 3 months ago by Forcetalks.
- This discussion was modified 4 years, 3 months ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
Sharing Settings in Salesforce | The Ultimate Guide
Salesforce is a powerful Customer Relationship Management (CRM) platform that offers a wide range of features and functionalities to its users. One of the most…
How to Find a Salesforce Partner: Guide on Evaluation Criteria & Cost Range
Despite Salesforce having powerful out-of-the-box solutions and features, at certain stages of the business lifecycle, it requires customizations, integration, and other configurations to be legally…
Can Salesforce Implementation Partner Be the Missing Piece of the Puzzle?
With innovation in technology, enterprises are leveraging a go-digital first approach with the best-in-class and out-of-the-box software. And, Salesforce CRM happens to be one of…
Popular Salesforce Videos
Get Started with Salesforce for Recruitment and Admissions: Recruitment and Marketing
This webinar is designed for Salesforce admins and users who work in Recruitment and Admissions. It covers all you need to know about using Salesforce…
How To Set Up A Site On Salesforce | Salesforce Development Tutorial
Learn how to set up a site on Salesforce. This tutorial will cover the following points - 1. Create Public Websites Choose a branded URL…
1st Year as a Salesforce Business Analyst
If you are interested in a Salesforce Career, check out Talent Stacker. This is what I used when I first started and ended up joining…
Popular Salesforce Infographics
The Ultimate Marketing Automation Glossary
Sometimes, it sounds like marketers are speaking another language—especially when using terms associated with specific tools and platforms. It gets even more complicated when certain…
How Customer Experience Is Rewriting the Rules of Business Success
Your guide to customer experience - Customers expectations are changing. And as they change, businesses face sky high standards for delivering customer experience that's a…
A Day in the Life Infographic: Best Practices Guide for Sales Users
The internet is full of sales best practices. But what most people forget is that, as a business, you need to come to the understanding…