Find your content:

Search form

You are here

I want to create two visualforce components so that the second can only be included if it is included inside the first


I want to create visualforce component similar to say pageblocktable. If you see the behaviour of pageblocktable it can only be included inside a pageblock. similarly columns can be included inside pageblocktable/datatable.

I want to replicate the same in my custom visualforce component such that component B can only be included inside component A.(both A and be are custom visualforce component)

Attribution to: Avidev9

Possible Suggestion/Solution #1

I would use <apex:attribute name="myValue"> and assign it to a boolean variable inside of component a and than use that to determine if it's coming from component b to determine if the parent is correct.

Attribution to: jordan.baucke

Possible Suggestion/Solution #2

If component B is always required within component A... why not build your B component within A component. Pass in "null" for attributes if you want component A without a component B.

Attribution to: Salesforce Wizard
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content