+ Start a Discussion
oaklandoakland 

How to pass parameters from a VF page template to component controller?

Hi. I'd like to pass parameter information into a apex:insert element. I've mocked up sort of what I'd like to do - which is to create a apex:parameter (something that in reality doesn't exist) and to populate that parameter from the actual page using a apex:property element (which doesn't exist in reality).  What I'd like to do is avoid creating mock_portlet1, mock_portlet2 etc. Thanks.

Template:
<apex:page controller="mockPortletController">
 <apex:messages />
<table><tr><td>
   <apex:insert name="mock_portlet" >
    <apex:param key="columnNo" />
   <apex:insert>
</td><td>
    <apex:insert name="mock_portlet" >
    <apex:param key="columnNo" />
   <apex:insert>
</td></tr></table>
<apex:page>

 

Page:
<apex:page controller="selectAllPortletDataController">
    <apex:composition template="myFormComposition">
    <apex:define name="mock_portlet">
        <apex:property key="columnNo" value="1"/>
    </apex:define>
    <apex:define name="mock_portlet">
        <apex:property key="columnNo" value="2"/>
    </apex:define>
   
    </apex:composition>
</apex:page>

 

Best Answer chosen by Admin (Salesforce Developers) 
nickwick76nickwick76

Maybe you can use a VF-Component and pass the parameter via that.

 

VF-component 'cmpName':

<apex:component >
<apex:attribute name="columnNo" description=".." type="String" />
<apex:attribute name="wo" description=".." type="WrapperObj" />

Test1: {!columnNo}

Test2: {!wo.someField}

</apex:component>

 In your page you include your component like this:

<c:cmpName columnNo="{!aColumnNumber}" wo="{!wrapperObjInstance}" />

 

HTH / Niklas

 

All Answers

sandeep@Salesforcesandeep@Salesforce

for this you need to reltedTo attribute.

for more information visit

http://www.salesforce.com/us/developer/docs/pages/Content/pages_email_templates_with_apex.htm

oaklandoakland

Uh? relatedTo is an attribute of messaging:emailTemplate.

 

My question is about visual force templates.

nickwick76nickwick76

Maybe you can use a VF-Component and pass the parameter via that.

 

VF-component 'cmpName':

<apex:component >
<apex:attribute name="columnNo" description=".." type="String" />
<apex:attribute name="wo" description=".." type="WrapperObj" />

Test1: {!columnNo}

Test2: {!wo.someField}

</apex:component>

 In your page you include your component like this:

<c:cmpName columnNo="{!aColumnNumber}" wo="{!wrapperObjInstance}" />

 

HTH / Niklas

 

This was selected as the best answer