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

219
Vistas
Angular2 one radio button not disabled

I have a series of radio buttons on a page that are grouped into a collection of "yes"/No" buttons. I want to disable them based on the value of a variable but only the "Yes" button gets disabled when I go to the page. I also have a drop down that changes the variables the ngModel is looking at (the "selectedIndex" variable in the code below) and if I use that drop down to select a different value and then reselect the original value both buttons are disabled. I know the code for the [disabled] is working since it works on the "Yes" button, just not the "No" button. Any ideas?

<div class="col-sm-2">
  <input type="radio"
        name="NewSites"
        id="newsitesyes"
        required="required"
        [value]="true"
     [(ngModel)]="quarterlyInfo[selectedIndex].NewSitesOrSitesNoLongerParticipating"
        [disabled]="quarterlyInfo[selectedIndex].StudyDataLocked" />
  <label for="newsitesno">Yes</label>
  <input type="radio"
        name="NewSites"
        id="newsitesyes"
        required="required"
        [value]="false"
 [(ngModel)]="quarterlyInfo[selectedIndex].NewSitesOrSitesNoLongerParticipating"
        [disabled]="quarterlyInfo[selectedIndex].StudyDataLocked" />
  <label for="newsitesno">No</label>
</div>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The same id (id="newsitesyes") for both inputs might be the problem.

over 4 years ago · Santiago Trujillo Denunciar
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