You need to sign in to do that
Don't have an account?
cpo87
Saving a visualforce page within a custom object page layout
I'm trying to provide a VF page inside a custom object page layout. I would like to allow my users to edit their information and click the save button without the VF page changing it's position within the inner frame. (See Screen shots)
Custom Object with VF Page before clicking Save commandButton
Custom Object with VF Page after clicking the Save commandButton
What is the best way to correct this? Is it possible to have the parent page refresh after the save commandButton is clicked.
Here is my code....
<apex:page StandardController="RPI_Request__c"> <apex:form > <apex:pageBlock > <apex:panelGrid dir="LTR" columns="6" id="theGrid"> <apex:outputText value="" id="one"/> <apex:outputText value="Owner(s)" id="two"/> <apex:outputText value="Start" id="three"/> <apex:outputText value="Finish" id="four"/> <apex:outputText value="Fix Needed?" id="five"/> <apex:outputText value="Estimated Completion" id="six"/> <apex:outputText value="Gather/Create Specifications: " id="seven"/> <apex:inputField value="{!RPI_Request__c.Gather_Create_Specs_Owner_Lookup__c}" id="eight"/> <apex:inputField value="{!RPI_Request__c.Gather_Create_Specs_Start__c}" id="nine"/> <apex:inputField value="{!RPI_Request__c.Gather_Create_Specs_Finish__c}" id="ten"/> <apex:inputField value="{!RPI_Request__c.Gather_Create_Specs_Fix__c}" id="eleven"/> <apex:inputField value="{!RPI_Request__c.Gather_Create_Specs_Est_Comp__c}" id="twelve"/> <apex:outputText value="Review/Finalize Specifications: " id="thirteen"/> <apex:inputField value="{!RPI_Request__c.Review_Final_Specs_Owner_Lookup__c}" id="fourteen"/> <apex:inputField value="{!RPI_Request__c.Review_Final_Specs_Start__c}" id="fifteen"/> <apex:inputField value="{!RPI_Request__c.Review_Final_Specs_Finish__c}" id="sixteen"/> <apex:inputField value="{!RPI_Request__c.Review_Final_Specs_Fix__c}" id="seventeen"/> <apex:inputField value="{!RPI_Request__c.Review_Final_Specs_Est_Comp__c}" id="eighteen"/> <apex:outputText value="Create Matrix: " id="nineteen"/> <apex:inputField value="{!RPI_Request__c.Create_Matrix_Owner_Lookup__c}" id="twenty"/> <apex:inputField value="{!RPI_Request__c.Create_Matrix_Start__c}" id="twentyone"/> <apex:inputField value="{!RPI_Request__c.Create_Matrix_Finish__c}" id="twentytwo"/> <apex:inputField value="{!RPI_Request__c.Create_Matrix_Fix__c}" id="twentythree"/> <apex:inputField value="{!RPI_Request__c.Create_Matrix_Est_Comp__c}" id="twentyfour"/> <apex:outputText value="Finalize Matrix: " id="twentyfive"/> <apex:inputField value="{!RPI_Request__c.Finalize_Matrix_Owner_Lookup__c}" id="twentysix"/> <apex:inputField value="{!RPI_Request__c.Finalize_Matrix_Start__c}" id="twentyseven"/> <apex:inputField value="{!RPI_Request__c.Finalize_Matrix_Finish__c}" id="twentyeight"/> <apex:inputField value="{!RPI_Request__c.Finalize_Matrix_Fix__c}" id="twentynine"/> <apex:inputField value="{!RPI_Request__c.Finalize_Matrix_Est_Comp__c}" id="thirty"/> <apex:outputText value="Mapping/Development: " id="thirtyone"/> <apex:inputField value="{!RPI_Request__c.Mapping_Dev_Owner_Lookup__c}" id="thirtytwo"/> <apex:inputField value="{!RPI_Request__c.Mapping_Dev_Start__c}" id="thirtythree"/> <apex:inputField value="{!RPI_Request__c.Mapping_Dev_Finish__c}" id="thirtyfour"/> <apex:inputField value="{!RPI_Request__c.Mapping_Dev_Fix__c}" id="thirtyfive"/> <apex:inputField value="{!RPI_Request__c.Mapping_Dev_Est_Comp__c}" id="thirtysix"/> <apex:outputText value="QA: " id="thirtyseven"/> <apex:inputField value="{!RPI_Request__c.QA_Owner_Lookup__c}" id="thirtyeight"/> <apex:inputField value="{!RPI_Request__c.QA_Start__c}" id="thirtynine"/> <apex:inputField value="{!RPI_Request__c.QA_Finish__c}" id="forty"/> <apex:inputField value="{!RPI_Request__c.QA_Fix__c}" id="fortyone"/> <apex:inputField value="{!RPI_Request__c.QA_Est_Comp__c}" id="fortytwo"/> <apex:outputText value="Integrated Testing: " id="fortythree"/> <apex:inputField value="{!RPI_Request__c.Integrated_Testing_Owner_Lookup__c}" id="fortyfour"/> <apex:inputField value="{!RPI_Request__c.Integrated_Testing_Start__c}" id="fortyfive"/> <apex:inputField value="{!RPI_Request__c.Integrated_Testing_Finish__c}" id="fortysix"/> <apex:inputField value="{!RPI_Request__c.Integrated_Testing_Fix__c}" id="fortyseven"/> <apex:inputField value="{!RPI_Request__c.Integrated_Testing_Est_Comp__c}" id="fortyeight"/> </apex:panelGrid> </apex:pageBlock> <apex:commandButton action="{!save}" value="Save" alt="Save" id="saveButton"/> </apex:form> </apex:page>
This is because you are using the standard controller save, which redirects you to the record view page for the object in question. This means that you get a standard salesforce page embedded in an iframe within your standard visualforce page.
The simplest way to correct this is to create a small extension controller that leaves the user on your Visualforce page after they click save. Something like:
and on the page:
standard VF behaviour will call your extension controller save rather than the standard one. Your extension delegates the actual saving to the standard controller and then returns null - which results in the current page refreshing rather than directing you off to the standard view page.
All Answers
try to use the following attributes in your <apex:page showheader="false" sidebar="false"> and see if it works
This is because you are using the standard controller save, which redirects you to the record view page for the object in question. This means that you get a standard salesforce page embedded in an iframe within your standard visualforce page.
The simplest way to correct this is to create a small extension controller that leaves the user on your Visualforce page after they click save. Something like:
and on the page:
standard VF behaviour will call your extension controller save rather than the standard one. Your extension delegates the actual saving to the standard controller and then returns null - which results in the current page refreshing rather than directing you off to the standard view page.
Great! Thank you Bob. Works perfectly and makes a lot more sense.
Hi, bob. You mention that this is the simplies way. I really need a way that does not involve righting a class. Any ideas?
Or at least a test method to test the extension you wrote?