I have a multiple fields like this:
<div class="row">
<div class="col-md-5 ">
<app-input [desc]="'Client Last name'" formControlName="clientOneLastName"></app-input>
</div>
<div class="col-md-1 ">
<input type="radio" name="name" (change)="selectedClient && selectField('name', selectedClient?.name)" [checked]="selectedClient?.name != ''">
</div>
<div>
<input type="radio" name="name" (change)="selectedClient2 && selectField('name', selectedClient2?.name)" [checked]="selectedClient?.name == '' && selectedClient2?.name != ''">
</div>
<div class="col-md-5 ">
<app-input formControlName="clientTwoLastName"></app-input>
</div>
</div>
<div class="row">
<div class="col-md-5">
<app-input [desc]="'Client First name'" formControlName="clientOneFirstName"></app-input>
</div>
<div class="col-md-1">
<input type="radio" name="surname" (change)="selectField('surname', selectedClient?.surname)" [checked]="selectedClient?.surname != ''">
</div>
<div>
<input type="radio" name="surname" (change)="selectField('surname', selectedClient2?.surname)" [checked]="selectedClient?.surname == '' && selectedClient2?.surname != ''">
</div>
<div class="col-md-5">
<app-input formControlName="clientTwoFirstName"></app-input>
</div>
</div>
I searching for client 1 and client 2 its working perfectly even if I try with new clients, the checked condition is working, but if I change the checkbox manually with clicking and I try to search for new client the checkbox gets stuck and the condition is not working it stay where I clicked last time other checkboxes where I didn’t clicked working perfectly, but where I clicked its not working by the condition
I have angular component for it, I tried “this.formGroup.markAsPristine();” but nothing, the formGroup gets refreshed after the new client is loaded because the checkboxes what I didn’t touched switching if there is no name or surname in selectedClient in client 1 so just the touched/manually changed ones are gets stuck
kriszzzz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.