Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
Set CommandButton Value on Javascript - salesforce

I tried to make button checkall and it will change value of selectlist to be true, after that, the value of button will be changed to uncheckall, but its not works. anyone know how to make it works? thanks

this is my code now

function toggleCheck() {
      var btn = document.getElementsByClassName("toggle_check")[0];
      var checkboxes = document.getElementsByTagName("input");
      alert('Btn '+ btn.value);
      console.log('Test Btn ' + btn.value);
      if (btn.value === "check all") {
        for (var i = 0; i < checkboxes.length; i++) {
          var check= document.getElementsByClassName("checkOpex")[i].value = 'True';
        }
        btn.value = 'uncheck all';
      } else {
        for (var j = 0; j < checkboxes.length; j++) {
          var check= document.getElementsByClassName("checkOpex")[i].value = 'False';
        }
        btn.value = 'uncheck all';
      }
}

<apex:column headerValue="Action" >
                    <apex:facet name="header">
                        <apex:commandButton styleClass="toggle_check" onclick="toggleCheck()" value="check all">
                            <apex:actionSupport event="onchange"/>
                        </apex:commandButton>
                    </apex:facet>
                    <apex:selectList id="inputId" value="{!acc.Opex__c}" styleClass="checkOpex" size="1">
                        <apex:selectOption itemValue="True" itemLabel="Checked" />
                        <apex:selectOption itemValue="False" itemLabel="Unchecked"/>
                        <apex:actionSupport event="onchange"/>
                    </apex:selectList>
                </apex:column>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda