@Adrian Larson: I can not use Action="{!clearSelect}" thats because I already have method that get the Id that I have selected on VFP controller, unless is there a way to capture Id in the Component Controller?

public void SelectId()
    String arId = System.currentPagereference().getParameters().get('arId');
    SelectId  = arId;           


After reading and I found this:

So in the Component I have added the following line:

<apex:attribute name="clearAction" 
    description="" type="ApexPages.Action" required="true"/>

in my VFP I have updated my component:

<c:example_component currentId="{!exampleId}" clearAction="{!clearSelect}" />

I have defined the void method clearSelect on Component controller but I'm not sure how to invoke this action from VFP.

I like to invoke the clearSelect method when the user clicks on the radiobutton

  <apex:actionsupport action="{!SelectId}" event="onclick" >  
    <input type="radio" name="arRadioButton"   />                    
    <apex:param name="arId" value="{!ar.Id}"></apex:param>


How to invoke Action on Component Controller from VFP to Component page? and I have laid down some lines of code and its very basic but the point here is to get the concept of how the event is fired. in this particular case, if the user clicks on the radiobutton i want to fire an event on the component page.

VisualForce Page:

<apex:page controller="vfp_Controller" showheader="true" sidebar="true">

<apex:form >
    <apex:pageblock id="arpageblock"  > 

     <apex:pageblocktable id="ar_pageblocktabel" value="{!AllRules}" var="ar">
         <apex:column headervalue="Action"  >                    
           <apex:actionsupport action="{!SelectId}" event="onclick" >  
                        <input type="radio" name="arRadioButton"   />                    
                        <apex:param name="arId" value="{!ar.Id}"></apex:param>

                <apex:column headervalue="Name" style="width:16%;">
                    <apex:outputfield value="{!ar.Name}">


          <c:example_component currentId="{!exampleId}" />


Component Page:

<apex:component controller="ExampleComponentController">
  <apex:attribute name="currentId" type="Id" assignTo="{!myId}" required="true" description="Example Id for display." />
  <apex:pageBlock >
    <apex:outputPanel layout="block">{!myUser.Name}</apex:outputPanel>
  • what do you mean by an 'event on the component'? a Javascript event? Or do you want an action function on the component to execute against the component's controller – cropredy Aug 12 '15 at 22:09
  • yes I meant to say Action invoked on the component's controller – Nick Kahn Aug 12 '15 at 22:17
  • did you read: salesforce.stackexchange.com/questions/50008/… ? – cropredy Aug 12 '15 at 22:28
  • I just went through and the action is more about passing a data but mine is more like invoking action on the component controller; if you think my answer is in the link which I could not able to catch please paste here. – Nick Kahn Aug 13 '15 at 0:41
  • 1
    if you want to call VF cpage controller action indide the component then i have a quick workaround for you. Pass a javascript method name in component and from javascript method call the Action function now in your component call this Javascript function. it willl do your work. Cheers... – Tushar Sharma Aug 13 '15 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.