You need to sign in to do that
Don't have an account?
BoolsEye
It works if I do not click on the commandButton on Tab2 before using the edit button.
apex:detail: ID is missing after 'Edit'
I have a weird behaviour when adding apex:detail and apex:commandButton on different tabs on a tabpanel.
In my code when I click on the commandButton on Tab2 the page gets refreshed.
Now I click on the standard 'Edit' button for the contact on Tab1, click on 'Cancel' and the Contact is gone.
It seems as if the ID is lost when the edit page is redirected back to my VF page.
It works if I do not click on the commandButton on Tab2 before using the edit button.
Is there any workaround for this or am I doing something wrong ?
Thanks.
Code:
<apex:page standardcontroller="Contact" extensions="MyContactControllerExt"> <apex:tabpanel > <apex:tab label="Tab1"> <apex:detail subject="{!Contact.Id}"/> </apex:tab> <apex:tab label="Tab2"> <apex:form > <apex:commandButton value="Go" action="{!doSomething}"/> </apex:form> </apex:tab> </apex:tabpanel> </apex:page>
Code:
public class MyContactControllerExt{ private Contact c; public MyContactControllerExt(ApexPages.StandardController controller) { c = (Contact)controller.getRecord(); } public PageReference doSomething() { return null; } public Contact getContact() { return c; } }
I found a solution in this thread.
You have to override the 'Edit' button with a second page.
I hope there will be a more elegant way in the future release.