You need to sign in to do that
Don't have an account?
S D
Standard controller used but Save button redirects the page to another page
Hi
I am using the below code , and looking it to perform its standard function of saving the change and not redirecting .
I am new to visual force so still not able to understand the correct usage of reRender, as using it on my below code,suffice the need of not redirecting it but in that case,changes are not saved.
<apex:page standardController="Account" recordSetVar="records" id="thePage">
<apex:form id="theForm">
<apex:pageBlock id="thePageBlock">
<apex:outputPanel id="locationPicker">
<apex:pageBlockTable value="{!records}" var="record" id="thePageBlockTable">
<apex:column >
<apex:outputField value="{!record.Name}" id="AccountNameDOM" />
<apex:facet name="header">Name</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!record.Type}" id="AccountTypeDOM" />
<apex:facet name="header">Type</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!record.Industry}"
id="AccountIndustryDOM" />
<apex:facet name="header">Industry</apex:facet>
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
<apex:inlineEditSupport event="ondblClick"
showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!save}" id="editButton" />
<apex:commandButton value="Save" action="{!save}" id="saveButton" reRender="locationPicker"/>
<apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
what shall be done to sort this out?
I am using the below code , and looking it to perform its standard function of saving the change and not redirecting .
I am new to visual force so still not able to understand the correct usage of reRender, as using it on my below code,suffice the need of not redirecting it but in that case,changes are not saved.
<apex:page standardController="Account" recordSetVar="records" id="thePage">
<apex:form id="theForm">
<apex:pageBlock id="thePageBlock">
<apex:outputPanel id="locationPicker">
<apex:pageBlockTable value="{!records}" var="record" id="thePageBlockTable">
<apex:column >
<apex:outputField value="{!record.Name}" id="AccountNameDOM" />
<apex:facet name="header">Name</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!record.Type}" id="AccountTypeDOM" />
<apex:facet name="header">Type</apex:facet>
</apex:column>
<apex:column >
<apex:outputField value="{!record.Industry}"
id="AccountIndustryDOM" />
<apex:facet name="header">Industry</apex:facet>
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>
<apex:inlineEditSupport event="ondblClick"
showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!save}" id="editButton" />
<apex:commandButton value="Save" action="{!save}" id="saveButton" reRender="locationPicker"/>
<apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
what shall be done to sort this out?
Can you provide the code for the controller class named " Account"
Regards
Pramod
and this works also,but as i said redirects to another page. i.e home page rather than be on Account page.
for reference: https://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_std_actions.htm
Can the reRender option help in getting the reference back to the same page ,post a button click?? or any attribute that can redirec the control back to the same page??
i have tried using the reRender in my code, but i am not aware if its a correct way to use.
I had a chance to lok at this and faced the same behaviour.
Not sure if this is by design but as a workaround you can have an extension controller as below.
VF Page:
=============
<apex:page standardController="Account" extensions="testcontroller123" recordSetVar="records" id="thePage">
Note: I removed the outputpanel and the rerender
Controller:
===============
public class testcontroller123 {
public testcontroller123(ApexPages.StandardSetController controller) {
}
public PageReference save()
{
return null;
}
}
I was able to inline edit and test it works.
You could try this for the others buttons as well.
Hope this helps!
If theree is another solution do let us know.
Please mark this as a best answer if your query is resolved so others also get help from this thread in future.
Thanks,
Aakaash
However, I feel then this solution contradicts to what salesforce says about Standard Controllers. As I understand, we need to use standard controller, when we Only want to use basic features provided by it And no extra feature is required to go for a customization.
So based on this understanding , when i am using standar controller = Account , with intension of using only basic feature then it should have worked without the support of extension. so now i am not getting the use of using Standard controllers over custom controller,when any ways we do need to customize the feature?
To be clear , I was expecting the below features of Standard Controller to behave as below:----->
1. Edit button: When clicked,like in Account page should change the view to an editable mode.{but in here i am trying use it on a list view,with an expectation of working on multiple records]..though not sure how it would turn .
2. Save: should work in the same manner as save button of Account Page,without directing to any other page.
3. Cancel: should allow me to revert my inline-editing,without directing to any other page. Like what it supports as part of button on standard Account Page.
CMRC, hope the above requirement clears what am i looking out for.