-
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 ago by
Saravjeet Singh.
-
This discussion was modified 6 years, 9 months ago by
Forcetalks.
-
This discussion was modified 6 years, 9 months ago by
Forcetalks.
-
This discussion was modified 7 years ago by
Log In to reply.
Popular Salesforce Blogs
Light For Nonprofits After Luminate | Salesforce Guide
Recently, Blackbaud revealed that Luminate CRM will be phased out on June 30, 2022. Blackbaud Luminate has a long successful past. This approach started as…
The Top 5 Benefits of Web-To-Lead
Web-To-Lead is the process of converting a website visitor into Lead. What is a Lead? A Lead is a potential Customer who is interested in…
Salesforce Administrator Exam Practice Quiz
Question 1: What is the maximum number of characters allowed for a custom text field in Salesforce? A) 50 characters B) 255 characters C) 500…
Popular Salesforce Videos
Are they secure enough ? Web to Lead Forms | Validations | SPAM | CAPTCHA | Salesforce Tutorials
Are you using web to lead forms ? Do you think it's secure enough ? In this video you will get all your answers. And…
How to Delete Multiple Contacts at Once | Salesforce Tutorial
Do you need to delete a bunch of records? Don't want to delete records one by one? This video shows you several ways to delete…
Quick Text in Salesforce | Service Cloud | Salesforce Tutorial
In this video, we will talk about what is Quick text and how to implement those Quick texts inside Salesforce. Watch the video and let…
Popular Salesforce Infographics
Enjoy the Salesforce Innovation Management infographic
Without innovation, a company will stay in one place. Without getting ideas from those closest to your product or service - customers, employees, and partners…
How To Crack Salesforce Admin Exams with Ease?
The demand for Salesforce Admin professionals is increasing day by day. industries are constantly looking for certified Salesforce Admins. Clearing Salesforce Admin Certification Exams is…
VT-What? How Salesforce Gives Back To ItsRainingRaincoats
ItsRainingRaincoats Founder Dipa Swaminathan grew up in Bangalore hearing about the need to be ‘other-regarding’ often. In Singapore, she noticed a divide between the country’s…