Good afternoon, I'm working on a non-angular project. In this project I have a form with several radio buttons, where each group of radio buttons represents a scale. What I need to do is, check the values of the selected radio buttons, and from the highest value found, change the checked property to true of the radio button corresponding to the value in the group of radio buttons G. Example: of all radios selected in the form, the highest value was 2, then the radio button of group G that corresponds to value 2, should be checked.
Follow the code to make it easier to understand:
<form #entryForm="ngForm" class="form">
<mat-card class="caixa fadeIn animated">
<div class="container">
<label class="G"> G <label class="fonteQuestionario">(Grau global da disfonia)</label> </label>
<mat-radio-group class="posicaoG" name="G">
<mat-radio-button class="margem" value="0" disabled>0</mat-radio-button>
<mat-radio-button class="margem" value="1" disabled>1</mat-radio-button>
<mat-radio-button class="margem" value="2" disabled>2</mat-radio-button>
<mat-radio-button class="margem" value="3" disabled>3</mat-radio-button>
</mat-radio-group>
<br>
<label class="G"> R <label class="fonteQuestionario">(Rugosidade) </label> </label>
<mat-radio-group class="posicaoR" name="R">
<mat-radio-button class="margem" value="0">0</mat-radio-button>
<mat-radio-button id="R1" class="margem" value="1">1</mat-radio-button>
<mat-radio-button class="margem" value="2">2</mat-radio-button>
<mat-radio-button class="margem" value="3">3</mat-radio-button>
</mat-radio-group>
<br>
<label class="G"> B <label class="fonteQuestionario">(Soprosidade) </label> </label>
<mat-radio-group class="posicaoB" name="B">
<mat-radio-button class="margem" value="0">0</mat-radio-button>
<mat-radio-button class="margem" value="1">1</mat-radio-button>
<mat-radio-button class="margem" value="2">2</mat-radio-button>
<mat-radio-button class="margem" value="3">3</mat-radio-button>
</mat-radio-group>
<br>
<label class="G"> A <label class="fonteQuestionario">(Astenia) </label> </label>
<mat-radio-group class="posicaoA" name="A">
<mat-radio-button class="margem" value="0">0</mat-radio-button>
<mat-radio-button class="margem" value="1">1</mat-radio-button>
<mat-radio-button class="margem" value="2">2</mat-radio-button>
<mat-radio-button class="margem" value="3">3</mat-radio-button>
</mat-radio-group>
<br>
<label class="G"> S <label class="fonteQuestionario">(Tensão) </label> </label>
<mat-radio-group class="posicaoS" name="S">
<mat-radio-button class="margem" value="0">0</mat-radio-button>
<mat-radio-button class="margem" value="1">1</mat-radio-button>
<mat-radio-button class="margem" value="2">2</mat-radio-button>
<mat-radio-button class="margem" value="3">3</mat-radio-button>
</mat-radio-group>
<br>
<label class="G"> I <label class="fonteQuestionario">(Instabilidade) </label> </label>
<mat-radio-group class="posicaoI" name="I">
<mat-radio-button class="margem" value="0">0</mat-radio-button>
<mat-radio-button class="margem" value="1">1</mat-radio-button>
<mat-radio-button class="margem" value="2">2</mat-radio-button>
<mat-radio-button class="margem" value="3">3</mat-radio-button>
</mat-radio-group>
</div>
<div><br><br><br><br><br></div>
<button class="previous"mat-mini-fab color="accent">
<mat-icon>keyboard_backspace</mat-icon>
</button>
<button class="next"mat-mini-fab color="accent">
<mat-icon>check</mat-icon>
</button>
</mat-card>
</form>