2
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 on the checkbok, it opens a div with a series of fields. So far so good and working. However, I need that instead of type="checkbox"
has been 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 above script to work with type="radio"
?
What exactly doesn’t work when changing type?
– André Ribeiro
When I change type='checkbox' to type='radio', oscript no longer works. That is the div I opened no longer opens.
– Jessi