Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

233
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda