+ Start a Discussion
Arul Bernard I 14Arul Bernard I 14 

How to merge two visual force page

I need to merge two visualforce page into a single page
NagendraNagendra (Salesforce Developers) 
Hi Arul,

Assuming that you want to show two visual force pages in a single page.

You can use the apex:include tag. Please refer to the Salesforce Docs for further details. If you want to dynamically display the pages based on the option selected, here is a simple solution for that:
<apex:page>
<input type="checkbox" id="option1" onclick="displayPage();">option1</input> <input type="checkbox" id="option2" onclick="displayPage();"> option2 </input>
<div id="option1Page" style="display:none;">
<apex:include pageName="vfpage1"/>
</div>

<div id="option2Page" style="display:none;">
 <apex:include pageName="vfpage2"/>
</div>
<script type="text/javascript">

    function displayPage() {
    if (document.getElementById('option1').checked ) {
     document.getElementById('option1Page').style.display = "block";
     document.getElementById('option1').checked=true;
    }
    else
    {
      document.getElementById('option1').checked=false;
      document.getElementById('option1Page').style.display = "none";
    }
    if (document.getElementById('option2').checked ) 
    {
     document.getElementById('option2Page').style.display = "block";
     document.getElementById('option2').checked=true;
    }
    else
    {
    document.getElementById('option2').checked=false;
    document.getElementById('option2Page').style.display = "none";
    }
    }

   </script>
</apex:page>
Hope this helps.

Kindly mark this as solved if the reply was helpful.

Thanks,
Nagendra