You need to sign in to do that
Don't have an account?
uHaveOptions
CONTROLLER
Shout out to Mahesh D for helping me out earlier.
Save Button Issue in Contact Standard Object
My previous request worked using commandbutton save in a custom object. And it's working just fine. But using that command in a Standard object doesnt work. Instead, it reloads the record inside the iFrame and does not save the data. Is there a difference on them? How can i fix this?
VISUALFORCE PAGE
<apex:pageBlockButtons > <apex:commandButton action="{!Save}" value="Save"/> </apex:pageBlockButtons>
<apex:page standardController="Contact" showHeader="false" sidebar="false" extensions="ContactExtensionController"> <!-- Define Tab panel .css styles --> <style> .activeTab {background-color: #081f3f; color:white; background-image:none} .inactiveTab { background-color: lightgrey; color:black; background-image:none} </style> <!-- Create Tab panel --> <apex:tabPanel switchType="client" selectedTab="Contact" id="ContacttabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab"> <apex:tab label="Contact Information" name="name" id="Contact"> <apex:form > <apex:pageBlock > <apex:pageblocksection > <apex:outputText style="font-size:20px;text-align:left;color:{!IF(Contact.Sales_Status__c = 'Proposal'||Contact.Sales_Status__c='Listing'||Contact.Sales_Status__c='Escrow'||Contact.Sales_Status__c='Sales Comp', 'red', '#081f3f')};" value="{0} | {1}"> <apex:param value="{!Contact.Name}"/> <apex:param value="{!Contact.Sales_Status__c}" /> </apex:outputText> </apex:pageblocksection> <apex:pageBlockButtons > <apex:commandLink value="Save" action="{!save}" target="_parent" styleClass="btn" style="text-decoration:none;padding:4px;"></apex:commandlink> </apex:pageBlockButtons> <apex:pageBlockSection columns="2"> <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" /> <apex:pageBlockSectionItem > </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Company Name" for="Contact.Account" style="font-weight:bold"/> <a href="/{!Contact.Account}" target="_blank">{!Contact.Account.name}</a> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Parent Company" for="Contact.Parent_Company__c" style="font-weight:bold"/> <apex:outputField value="{!Contact.Parent_Company__c}" id="Contact"/> </apex:pageBlockSectionItem> <apex:pageBlockSectionItem > <apex:outputLabel value="Confirmed Owner" for="Contact.Confirmed_Owner__c" style="font-weight:bold"/> <apex:outputField value="{!Contact.Confirmed_Owner__c}" id="Contact"/> </apex:pageBlockSectionItem> </apex:pageBlock> </div> </apex:page> </apex:tab> </apex:tabPanel> </apex:page>
CONTROLLER
public class ContactExtensionController{ Contact Contact; // public String currentUser = UserInfo.getUserId(); public ContactExtensionController(ApexPages.StandardController controller) { Contact = (Contact)controller.getRecord(); } public PageReference save() { update Contact; return null; } }
Shout out to Mahesh D for helping me out earlier.