Good morning, I have the following code:
function exibe() {
var tipo = "${mainForm.tipo}";
var man_tipo = "${mainForm.man_tipo}";
if ((man_tipo == 'B' && tipo.search('V').toFixed(0) < 0)) {
if (document.form_folhatd_teste.teste.checked) {
document.getElementById('pressao_min').style.display = '';
document.getElementById('pressao_max').style.display = '';
document.getElementById('vazao_min').style.display = '';
document.getElementById('vazao_max').style.display = '';
} else {
document.getElementById('pressao_min').style.display = 'none';
document.getElementById('pressao_max').style.display = 'none';
document.getElementById('vazao_min').style.display = 'none';
document.getElementById('vazao_max').style.display = 'none';
}
}
}
<td>
<input type="checkbox" value="true" name="teste" id="teste" <#if (folhaTDMecanicoForm.lub_forcada)>checkbox</#if>onclick="javascript: exibe();">
</td>
Which does the following: When the user clicks checkbok, opens a div with a series of fields. So far so good and working. However, I need to instead of type="checkbox"
have type="radio"
. See the HTML below.
<td>
Quando selecionado não abre nada
<input type="radio" value="nao_abri" name="teste" id="teste">
</td>
<td>
Quando selecionada abre a div 1
<input type="radio" value="abri1" name="teste" id="teste" <#if (folhaTDTesteForm.teste)>checked</#if>onclick="javascript: exibe();">
</td>
<td>
Quando selecionada abre a div 2
<input type="radio" value="abri2" name="teste" id="teste" <#if (folhaTDTesteForm.teste)>checked</#if>onclick="javascript: exibe();">
</td>
How can I adapt the script above to work with type="radio"
?