I have an apex command button inside apex form with it's action calling an apex pagereference method.

This makes the page reload every time I click the button. Can someone please help regarding this?

Apex Command Button

<apex:commandButton value="Apply Outcome" action="{!updatei}" onclick="return false;" disabled="{!oInc.Confirm_Attestation_abv__c==true}"/>

use reRender attribute on apex:commandButton

here is a nice article Implementing Partial Page Updates with Command Links and Buttons where all required steps are listed

  1. First, create or identify the portion of the page that should be rerendered. To do this, wrap the tag in an <apex:outputPanel> tag, and give the output panel an id parameter. The value of id is the name that we can use elsewhere in the page to refer to this area. It must be unique in the page.
  2. Next, indicate the point of invocation (the command link) that we want to use to perform a partial page update of the area that we just defined. To do this, add a reRender attribute to the <apex:commandLink> tag, and give it the same value that was assigned to the output panel's id.

The ID of one or more components that are redrawn when the result of an AJAX update request returns to the client. This value can be a single ID, a comma-separated list of IDs, or a merge field expression for a list or collection of IDs.

lets, say, you want to have whole apex:form to be rerendered.

<apex:form id="mainForm">
        value="Apply Outcome"
        onclick="return false;"

at same time method updatei should be void or return null.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.