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
abivenkatabivenkat 

a doubt in creating a visualforce component

 

hi,

 

i want to create a Value attribute for my custom component. "Value" attribute is the one which is used to get the value in the corresponding controller class in all the default visualforce components. how to create that "Value" attribute for my custom component? we use this "Value" attribute to pass our values to controller class, we retrieve this by putting get, set in controller class, now how can i do in this??

 

for example :

<apex:page controller="Sample">

<c:sampleComp Value="{!ControllerClass}" />

</apex:page>

 

i want to pass that value attribute to the controller class called "Sample". Then how should i code this attribute to work like above??

i need any code example to achieve this functionality.. please help me..

 

thanks,

abivenkat,

SFDC Learner

 

prasad_more1.3158103303596086Eprasad_more1.3158103303596086E

<!-- Markup for component -->

<apex:component >
<apex:attribute name="value" description="creating value attribute for component" type="String" required="true"/>
<apex:outputText title="Viewing {!value}" />
</apex:component>

 

<!- Markup for Visualforce page -->

<apex:page standardController="Account">
<c:ValueAttribute value="{!Account.Name}" />
</apex:page>

abivenkatabivenkat

 

hi,

 

i have tried your solution, but, it is not working.. 

in my component, there is a label, textbox and a button. Now the value attribute should take the textbox's value and pass it to the visualforce page's controller class, in which all other visualforce components does. here, as this is a custom component, i dont know how to take the value from textbox using the value attribute and send it to the components controller class. then, from there i have to try returning it to the Visualforce pages' controller class where this component is being used... 

Or is there any other solution available to solve this problem... please help

 

thanks,

abivenkat,

SFDC Learner