+ Start a Discussion
Chitra ThambirajanChitra Thambirajan 

How to include a visualforce page inside of another page

I have a visualforce page which contains 4 tabs.In one of the tab i need to include another visualforce page.

When I tried to do this with <apex:include> i got the following error
" Error: 'apex:form' component cannot be nested within form tags "
If I remove form tag in anyof the page,it contains lots of components that can not survive without form.

For instance if I delete the form tag then it is showing the error like
" Error: <apex:selectRadio> (under <apex:page>) must occur between <apex:form></apex:form> tags. "

In this situation how can I include one visual force page inside of another..?

Any idea would be appreciated..

Thanks in advance
Chitra
Best Answer chosen by Chitra Thambirajan
Bhawani SharmaBhawani Sharma
<apex:iframe src="{!pageNameVariable}" />

All Answers

Sagar PareekSagar Pareek
Hi Chitra,

Have you tried out using iframes?
I would suggest to use iframe instead of apex:include.

Thanks,
Sagar.
Chitra ThambirajanChitra Thambirajan
No Sagar I did not tried..It may work I guess..
Is it same like simple iframe tag which we use in HTML...?
How can I get the page url to give for iFrame 'src' property..

Thanks in advance
Chitra
Bhawani SharmaBhawani Sharma
<apex:iframe src="{!pageNameVariable}" />
This was selected as the best answer
Chitra ThambirajanChitra Thambirajan
Hi Sharma,

Sorry it might be a silly doubt..But I really dont know how to acheive..

<apex:iframe src="{!pageNameVariable}" /> - what must be the value for "pageNameVariable"
I should not place the visual force page name right.How can I map this variable with my VF page name...??

Thanks
Chitra
Bhawani SharmaBhawani Sharma
if you want to bind the bind the page name dynamically from controller, you can use or if you want to include a fix page then
Chitra ThambirajanChitra Thambirajan
I have included the page like this
<apex:iframe src="pageToBeIcluded" />
Page is included but the entire page is coming,

Error image

I need only the page components..I do not want lfet navigation,it should work same like <apex:page showHeader="false">
but how can i achieve this in the <apex:iframe>... ??

Thanks in advance
Chitra
Bhawani SharmaBhawani Sharma
Can you try, or
Chitra ThambirajanChitra Thambirajan
My Mistake Mr.Bhawani Sharma..
I just added showHeader="false' parameter with the inner page.
So now the framed page is coming as expected without the header & side bar..

Thanks
Chitra
Nathan MarchantNathan Marchant
Im trying to do the same thing.  I have: 

 
<apex:iframe src="{!pageNameVariable}" />

 pageNameVariable = '/apex/EmbeddedFile';

But the iframe opens with the login screen asking the user to login?!?! How do i stop this from happening and opening the vf straight away? 

Thanks