-
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, 1 month ago by Saravjeet Singh.
- This discussion was modified 4 years, 10 months ago by Forcetalks.
- This discussion was modified 4 years, 10 months ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
Object Level Security in Salesforce | The Salesforce Security Guide
We may provide access to an item in Salesforce at the profile or permissions set level. From the Profile or Permission set level, you may…
Fight Against COVID-19: How is Salesforce Helping?
The world has seen various pandemics in the last century, such as influenza, H1N1, H2N2, H3N2, and many more. Though the world has fought them…
Dreamforce 2023 Key Highlights | The Ultimate Guide
On September 12, 2023, the realms of technology and business once again united for the year’s highly anticipated event – Dreamforce 2023. Over 40,000 individuals…
Popular Salesforce Videos
Salesforce Lightning: Custom Theming and Branding
As part of myLightning, Custom Theming and Branding for Lightning Experience lets you customize key styling elements, such as the global header color, brand image,…
Can Salesforce Developers and Consultants Choose Architect Track?
A Salesforce Consultant works to help companies meet their missions by driving client-specific implementation as well as ongoing system improvements on the Salesforce platform. The…
Using Lambdas to Overcome Salesforce Governor Limits
Salesforce is a great CRM product, but it has some limitations that can prove troublesome depending on the situation. Since each org has to share…
Popular Salesforce Infographics
10 Common Salesforce Mistakes—and How to Avoid Them
Salesforce integration is challenging if you don’t know exactly what you’re getting into. It’s an enormously valuable project, but diving into it without proper understanding…
Automation Tools In Salesforce
Automation tools in Salesforce can eliminate monotonous tasks, freeing up an admin’s time to do more profound things. These tools include Workflow Rules, Process Builder,…
Customer Service Words and Acronyms
Savvy service reps know it is important to stay hip with the lingo. If it seems like customers and agents always keep you guessing with…