Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8602117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:00:13+00:00 2026-06-12T02:00:13+00:00

I have a commandButton in a visualforce component. The expected behavior is that the

  • 0

I have a commandButton in a visualforce component. The expected behavior is that the controller method would be called. The page is refreshed, but the method registered in the commandButton {!performUnlinkContact} is not called. The strange thing is that if I put the button on the base visualforce page, it calls the controller method as expected – but when in a component, it does not.

Here is my component:

<apex:component >
    <apex:attribute name="rk" description="RK Base Contact Data"  type="Object" required="true"/>

    <div class="unlinkBox">
        <div class="unlinkHeader">
            <div class="unlinkHeaderLeft">Wrong Contact?</div>
            <div class="unlinkHeaderRight"><a href=""  onclick="return hideUnlinkPanel()"><apex:image style="cursor: pointer;" value="{!$Resource.x}" alt="Close Panel" /></a></div>
        </div>
        <div class="unlinkBody">
            <div class="unlinkBodyLeft">
                Click Yes if the Contact displayed is incorrect.<br/><br/>You will be given the opportunity to link to a different Contact.
            </div>
            <div class="unlinkBodyRight">
                <apex:outputpanel id="callMethod">
                    <apex:commandbutton value="Yes, this is the wrong contact" action="{!performUnlinkContact}" rerender="" status="myDisplayStatus" />&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="return hideUnlinkPanel()" style="color:blue;cursor:pointer;text-decoration:underline">No</a>
                </apex:outputpanel>
                <apex:actionStatus id="myDisplayStatus"  startText="(performing Contact Unlink...)"  stopText=""/>
            </div>
        </div>
    </div>
</apex:component>

and here is the method in the controller extension:

public PageReference performUnlinkContact() {
     System.debug('==================================!!performUnlink');
    if (this.thisLead.rkContactId__c != 0) {
        this.thisLead.rkContactId__c = 0;

        update this.thisLead;
    }

    return null;
}

I’m sure I must be doing something wrong since I am new to salesforce and still learning, but I am unable to find any related issues when I search on how to resolve this issue. Thanks in advance for the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:00:15+00:00Added an answer on June 12, 2026 at 2:00 am

    Thanks for the replies – to resolve I ended up adding an actionFunction to the base Page, then just calling this function in the component via a button’s onclick event:

    Code in base page:

        <apex:actionFunction name="doUnlink" action="{!performUnlinkContact}" rerender="refresh" status="myStatus"/>
    

    Code to call function in the component:

        <input type="button" value="Yes, this is the wrong contact" onclick="doUnlink();" />
    

    This method seems to work well so far.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Facelets Composite component that includes, among other things, a commandButton: <?xml
I have a visualforce page which is rendering correctly. There is a commandbutton Save
In my JSF 1.2 webapp I have a page with a <h:commandButton> that invokes
I have an inputText and a commandButton in a JSF page. The user inputs
I have something like: <h:commandButton> <h:ajax event=click listener=#{controller.onLog} onchange=onLogProcess /> .... </h:commandButton> I send
I have the following layout in my page (simplified) <h:form> <h:commandButton action=#{bean.save} value=Save/> <rich:tabPanel
Suppose i have JSF page <h:body> <h:form id=formID prependId=false> <h:outputText id=randomID value=#{randomNumber.random}/> <h:commandButton id=buttonID
I have a commandButton in JSF 2.0 with a actionvalue that I want to
I have simple component - CommandButton <tr:commandButton text=test styleClass=form-button actionBean=#{testPage} action=synchAction partialSubmit=true id=btnId />
I have this button in header that I include in many page: <input type=button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.