0
I have 3 DropDownList
, take their values, multiple and display result. However, I do not want to display this information in numerical format, but rather a label
, as well as mineDropDownList
.
They are Enum, which has its values, but when it comes to exhibiting label
.
I want to do the same with this field where I display the multiplication value.
Like, if my result is > 100 it should display very serious, if < 100 && >= 76 serious, etc. But I don’t know how to do that. Someone can give me a help?
function UpdateClassificacao() {
var freq = $('select[name="Frequencia"]').val();
var grav = $('select[name="Gravidade"]').val();
var cont = $('select[name="Controle"]').val();
console.log('freq: ', freq);
console.log('grav: ', grav);
console.log('cont: ', cont);
if (freq && grav && cont) {
var resultado = (freq * grav * cont);
$('input[name="Classificacao"]').val(resultado);
//Grave:
// if (resultado > 100) { alert("Gravissimo") }
//if (resultado < 100 && resultado <= 76) { alert("Grave") }
//if (resultado < 75 && resultado >= 51) { alert("Moderado") }
//if (resultado > 26 && resultado <=50) { alert("Leve") }
//if (resultado <= 25) { alert("Menor") }
} else {
$('input[name="Classificacao"]').val('-');
}
}
$(function () {
if ($('input[name="Classificacao"]').val() == '') {
$('input[name="Classificacao"]').val('-');
}
$('select[name="Frequencia"]').on('selectmenuchange', function () {
UpdateClassificacao();
});
$('select[name="Gravidade"]').on('selectmenuchange', function () {
UpdateClassificacao();
});
$('select[name="Controle"]').on('selectmenuchange', function () {
UpdateClassificacao();
});
});
Thank you very much, gave me a very good direction. I managed to solve
– user124673