-
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 7 years, 1 month ago by
Saravjeet Singh.
-
This discussion was modified 6 years, 10 months ago by
Forcetalks.
-
This discussion was modified 6 years, 10 months ago by
Forcetalks.
-
This discussion was modified 7 years, 1 month ago by
Log In to reply.
Popular Salesforce Blogs
Agentforce Sales Explained: Features, Benefits, Pricing & Applications
Sales teams are increasingly looking for ways to reduce administrative work, respond to prospects faster, and make better use of customer data. Traditional CRM systems…
Breaking Down the Basics of Salesforce MuleSoft
We all know the feeling. You've got a to-do list, but somehow it never seems to get any shorter. Your IT team is no different.…
How Partner Portals Can Help Computer Hardware Businesses Gain a Competitive Advantage?
The most popular computer business in the world started with and because of a partnership. Steve Wozniak would have happily given away anything he made…
Popular Salesforce Videos
Schedule Batch Apex | Asynchronous Apex in Salesforce | Learn Salesforce Development
Watch this video tutorial to learn how to schedule batch apex in Salesforce. If you have any doubts or concerns do let us know in…
Discover Lightning Web Components | Salesforce Tutorial
Watch this Salesforce tutorial. After completing this unit, you’ll be able to: Explain the Lightning Web Components programming model. List the benefits of using Lightning…
Tracking Member Engagement with Scoring and Dashboards
More than half of organizations with a member engagement plan reported that it helped them increase: Membership renewals by 51%. Attendance at events and webinars…
Popular Salesforce Infographics
Salesforce & Blockchain : Driving Businesses at the Speed of Trust
Knowing the disrupter and the thought leader mind, Marc Benioff always has a way of looking at things with a beginners mind. With this thinking…
Top Salesforce Trends For 2023
When it comes to managing customer databases, Salesforce is leading the pack. Companies are increasingly relying on this powerful tool for its unrivalled flexibility and…
How to Choose the Right CRM for Your Business?
There are many CRM solutions for companies to choose from, and wading through the wide range of options can seem like a daunting task. Choosing…