+ Start a Discussion
MellowRenMellowRen 

Can I pass a parameter with an apex:include?

Hi

 

I am setting up a dashboard like information page using Visualforce. Due to a need for flexibilty on what to display based on profiles and other factors the page is essentially just a panelGrid with apex:include tags in each table cell.

 

I have one (sub-)page which produces a graph. On the main page, I would like two of these graphs, side by side, one displaying this quarter's data the other, next quarter's. Seems to me that I should be able to include the page twice and pass a parameter to let the controller know which quarter to use. I tried using URLFOR but can’t seem to get it to work:

 

<apex:outputPanel >
     <apex:include pageName="{!URLFOR($Page.FPGraph,null,[thisQtr=true])}" id="FPGraphThisQ"/>
</apex:outputPanel>

--------------------------------------------------------------------------------------
Visualforce Error

The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not include spaces, end with an underscore, or contain two consecutive underscores.

Seems like pageName doesn’t accept an actual URL or I am configuring the URLFOR wrong.

 

Is there a way to do this, or another tact I could take?

 

Regards

MellowRen

crop1645crop1645

another approach would be to use VF components (see apex:component tag)  Components can have dynamic bindings to either controller variables in your main VF page (by passing attributes) or, components can have their own custom controllers, that fetch data per values passed as component attributes.