function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rickynrickyn 

Dynamic Component now showing within apex:composition tag. Help?

I am using Dynamic Visual force and have a werid problem.

 

My dynamic component does not work within the apex:composition tag, however it works outside the tag.

 

Is this a known limitation?

 

<apex:page showheader="false" controller="ProjReqController" action="{!ServiceInfoPageLoad}" standardStylesheets="false" ><!-- cache="True" expires="600" -->

 <apex:composition template="{!if($Site.LoginEnabled,$Site.Template,$Page.Cervice_Trust_User_Site_Template)}"> 
   <apex:define name="body"> 


 <apex:dynamicComponent componentValue="{!DynamicForm}"/> <!--Does not work here-->
   

</apex:define> 
   
</apex:composition>

 <apex:dynamicComponent componentValue="{!DynamicForm}"/> <!--Works here--->

</apex:page>

 

SeAlVaSeAlVa

Extract from http://www.salesforce.com/us/developer/docs/pages/salesforce_pages_developers_guide.pdf

 

Dynamic Components Restrictions
Not every feature of Visualforce makes sense in a dynamic context, so some components are not available dynamically. This
section describes some limitations of dynamic Visualforce components.
• The following standard Visualforce components don’t have corresponding dynamic representations in Apex:
◊ <apex:attribute>
◊ <apex:component>
◊ <apex:componentBody>
<apex:composition>
◊ <apex:define>
<apex:dynamicComponent>
◊ <apex:include>
◊ <apex:insert>
◊ <apex:variable>

Regards.

rickynrickyn
Thank you for your response. I read that from the docs and interpreted it as I can not have a dynamic component that is a composition tag, not that I can't include a valid dynamic component within static composition tags? I am trying to do the latter, I'm I interpreting the doc wrong ?
aballardaballard

That section of the doc definitely refers to not being able to create an apex:composition dynamically.

 

Superficially, what you have looks like it should be valid.  When you say it "does not work"  what do you mean?  What happens?

 

rickynrickyn

Nothing renders on the vf page and the getDynamicForm() Method does not get called (My Debug msg doesnt show in dev console)

 

When it is outside the composition tag it renders on the vf page and the Debug msg shows in my log.

 

public Component.Apex.Form getDynamicForm() {
    System.Debug('DEBUG: Entered getDynamicForm');
........

   
    return dynForm;

}

 

aballardaballard

I suggest you open a support case on this....