Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
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 answers
Answer question

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!