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
priya burghatepriya burghate 

Dyanamic component....

Hi All,
I have 3 classes in and their  individual vf page...In all the classes Categorey,Category Area,Category cluster fields are there which are dependent picklist . And I want to create one component where objectname and there fields are taken automatically through the vf page . whereever i added this component only those object fields which are corresponding to that vf page should dislplay...
can anyone please help?

Thax
Priya
Vishal_GuptaVishal_Gupta
Hi Priya,

you can pass attribute values in your component from VF page, and using those values you can implement your custom logic in your component controller. You can use below code snippet :

<apex:component controller="yourControllerName" access="global">
          <apex:attribute name="objectName" type="String" assignTo="{!controllerPropertyToassignValue}"  />
          <apex:attribute name="fieldName"   type="String" assignTo="{!controllerPropertyToassignValue}"  />

</apex:component>


<apex:page>
         <c:componentName objectName="{!valueToBind}" fieldName="{!valueToBind}"/>
</apex:page>

Please let me know if you need more help.

Thanks,
Vishal