tengo el siguiente código en un form for de view:
<div class="form-group col-xs-6">
<%= f.label :Competition_type %> <br>
<%= f.radio_button :type_competition, :value => "regression", :checked => true, id: "type_regression" %>
<%= f.label :type_competition, "Regression"%>
<%= f.radio_button :type_competition, :value => "classification", id: "type_classification" %>
<%= f.label :type_competition, "Classification"%>
</div>
<div class="form-group col-xs-6">
<%= f.label :Performance_metric %>
<%= f.select(:metric, options_for_select([['Mean Absolute Error'],['Root Mean Squared Error'], ['Weighted Mean Absolute Error'], ['Accuracy'],['Mean Utility']]), {}, {class: "form-control", id: "selectMetric"}) %>
</div>
Alguien me echar una mano para hacer una función JavaScript que cuando se marque el radio button "regression", en el select solo aparezcan ['Mean Absolute Error'],['Root Mean Squared Error'], ['Weighted Mean Absolute Error'], y cuando se marque el radio button "classification" solo aparezcan ['Accuracy'],['Mean Utility'].
Código generado
<div class="form-group col-xs-6">
<label for="competition_Competition_type">Competition type</label> <br>
<input class="my_radio" type="radio" value="regression" checked="checked" name="competition[type_competition]" id="competition_type_competition_regression" />
<label for="competition_type_competition">Regression</label>
<input class="my_radio" type="radio" value="classification" name="competition[type_competition]" id="competition_type_competition_classification" />
<label for="competition_type_competition">Classification</label>
</div>
<div class="form-group col-xs-6">
<label for="competition_Performance_metric">Performance metric</label>
<select class="form-control" id="selectMetric" name="competition[metric]">
<option value="Mean Absolute Error">Mean Absolute Error</option>
<option value="Root Mean Squared Error">Root Mean Squared Error</option>
<option value="Weighted Mean Absolute Error">Weighted Mean Absolute Error</option>
<option value="Accuracy">Accuracy</option>
<option value="Mean Utility">Mean Utility</option>
</select>
</div>
Se lo agradeceré enormemente, ya que estoy bastante atascado en esto, no encuentro la info suficiente y necesito continuar 😥
Muchas gracias a quien responda :)