1

I have a VF page. I can put this page to a standard Case layout and it will be rendered as a separate component within the iframe tag.

<iframe id="06670000000QPBq" width="100%" height="600px" frameborder="no" title="CommentListEx" scrolling="yes" name="06670000000QPBq" marginwidth="0" marginheight="0">

This embedded page does not have the master page header and footer and visually looks like a part of the original standard layout page.

What I need to do is to put the same VF page to another VF page so the inner page visually looks as a part of its parent VF page like in case of a standard layout. I cannot find a way to do this.

I know about the apex:include tag, but it just inserts the rendered VF page into its parent page without using iframe. Moreover, when I try to use this, I cannot save the parent VF page due to the 'apex:form' component cannot be nested within form tags error.

Another option I tried is the apex:iframe tag. However, it also does not produce the expected result - the rendered frame looks and behaves differently:

<iframe id="contentPane" frameborder="0" title="Content Pane" style="width: 100%; height: 100%" src="/blank.html" onload="initContentFrame('https://c.cs24.visual.force.com/apex/CommentListEx?readOnly=true&Id=5001900000150MuAAI&core.apexpages.devmode.url=1', true, false , 'https://cs24.salesforce.com' );" name="contentPane">

The generated frame has master page header and footer and also a border.

So, is there a way to embed a VF page to another VF page in the same way as it can be embedded to a standard layout?

5
  • 1. Are header and sidebar turned off in the embedded page itself? 2. Have you tried plain html iframe instead of apex:iframe?
    – bananka
    Jun 3 '15 at 11:39
  • Thanks for responding! 1. Initially no, since the VF page inserted to standard layout does not have them. I tried removing the header and footer from the inner page implicitly, but the result is still not the same: the Developer bar is displayed at the bottom of the frame and the blue border is drawn around the frame. 2. I do not see any sense in this: the inner VF page will be inserted in its "natural" state and not as I want - like on a standard Case layout page. Jun 3 '15 at 13:03
  • In the page that you want to insert have you set the showHeader and sidebar attribute to false in the <apex:page> tag? This will remove the sidebar and the header from the injected page
    – Sam
    Jun 3 '15 at 14:07
  • When working with a VF page, there is the developer bar at the bottom that allows you modifying the page. When I set showHeader and sidebar to false in the inner VF page, this developer bar is still displayed at the frame's bottom. So, unfortunately, this does not help. Jun 4 '15 at 13:51
  • iframe should work...You can make show header and sidebar ...False in inner page...And developer may be visible because you are in development mode!
    – Ayub
    May 30 '18 at 4:26
1

We can insert a visualforce page into another visualforce page by using the include component and the page name attribute the page name attribute specifies the name of the page which we want to insert. The page name should be same as the name of the page which we want to insert. The most important thin is that the contrllers for thos epages will work independently. eg: <apex:page> <apex:include pagename=”xyz”/> </apex:page>

2
  • Thanks for your reply, but this does not work. My inner page has the form tag and this is not permitted with the <apex:include> tag. Also, is it possible to specify pass GET parameters to this inner page (e.g. myVFPage?readOnly=true)? Jun 4 '15 at 13:50
  • Yes it is possible to pass variables to inner page. You need to remove form tags from from the inner page so that it could be included in an area of page which also includes form tag. Jul 26 '16 at 20:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.