i have a program that can update multiple value, i wanted to give settimeout 2 second after click on spesific checkbox. when settimeout is loading the other checkbox in apex-repeat is disabled and when the settimeout is over the other checkbox will be enable again.

i tried so many ways and still not figure it out. is it possible?

this is my code now:

<apex:repeat value="{!dataSalesPlan}" var="i">
<apex:inputCheckbox styleClass="checkOpex{!i.spd.ID} checkOpex {!i.spd.ID}" value="
   <apex:actionSupport event="onchange" action="{!updateOpex}" reRender=""> 
   <apex:param name="salesPlanIndex" value="{!i.index}" assignTo="{!salesPlanIndex}"/>


<script type="text/javascript">
    document.documentElement.style.setProperty('--screen-width', (screen.width - 120)+'px');
    j$ = jQuery.noConflict();
    j$(document).ready(function() {
        j$(document).on('change', '.checkOpex', function(e) {
            var self = $(this);
            $(this).prop('disabled', true);
            setTimeout(function() {
            alert("Succesfully Set Data");
            }, 2000);

Apex Code:

public List<Sales_Plan_Detail__c> getDataSalesPlan {get;set;}
public List<SPDWrapper> dataSalesPlan {get;set;}
public Id[] updateSPDIds {get;set;}
public Map<Id, Boolean> updateOpexList {get;set;}
public Integer salesPlanIndex {get; set;}

public void updateOpex() {
    SPDWrapper spdWrapper = dataSalesPlan[salesPlanIndex];
    if(spdWrapper != null){
        updateOpexList.put(spdWrapper.spd.Id, spdWrapper.opex);
            if(spdWrapper.simulationSalesPrice < 100000000) {
                updateOpexList.put(spdWrapper.spd.Id, false); 

Ilustrasi enter image description here

1 Answer 1


The problem is that you're using apex:actionSupport. That means that the changes you're making in JavaScript is being overwritten by the Visualforce runtime. You shouldn't mix server-side and client-side HTML updates simultaneously. I don't know what you're doing in updateOpex, but you should move it to the client-side code if possible, delay the server-side update until after the setTimeout fires, or use apex:actionSupport oncomplete to disable the checkboxes again.

  • I already update my question to show updateOpex code. can i show alert and set disable button from server side? if u dont mind could you give me some example, thankyou so much for your help Commented Apr 25, 2022 at 1:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .