2

I am trying to overwrite the standard buttons on a standard object with an embedded VF page. The reason for this is that I want a custom button to be conditionally rendered based upon a field in the record. I get the buttons to display, but when I click them they open within the detail page of the record. How do I get them to open over the existing page like standard buttons normally do?

<apex:page standardController="Contract" >
<apex:form >
<div style="text-align: center">
    <apex:commandButton value="Edit" action="{!Edit}"/>
    <apex:commandButton value="Delete" action="{!Delete}"/>
    <apex:commandButton value="Clone" action="{!URLFOR($Action.Contract.Clone,Contract.id)}"/>
    <apex:commandButton value="Amend" OnClick="window.open('/apex.VF_Quote');"/>
</div>
</apex:form>
</apex:page>
1
  • Can you clarify - [within the detail page]? With your current implementation, it should open in a new window, is that not happening right now? And can you clarify, what do you expect? Commented Aug 24, 2018 at 20:35

2 Answers 2

3

Add target to the parent tag, as you can see the following code i have added to the <apex:form>, i have tested and it's working

<apex:page standardController="Account" >
<apex:form target="_parent" >
<div style="text-align: center">
<apex:commandButton value="Edit" action="{!Edit}" />
<apex:commandButton value="Delete" action="{!Delete}"/>
</div>
</apex:form>
</apex:page>
0
0

Add a target for your custom buttons like below:

<apex:commandButton value="Amend" OnClick="window.open('/apex.VF_Quote');" target="_self"/>

Following are the options for target:

  • _blank : Opens the linked document in a new window or tab
  • _self : Opens the linked document in the same frame as it was clicked (this is default)
  • _parent : Opens the linked document in the parent frame
  • _top : Opens the linked document in the full body of the window
2
  • I get an error message that target is an unsupported attribute. Commented Aug 24, 2018 at 20:14
  • 1
    target is not a supported attribute for apex:commandButton Commented Aug 24, 2018 at 20:36

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.