1
<t:selectOneRadio layout="pageDirection"
forceId="true" forceIdIndex="false" id="selectCodigoProcesso"
rendered="#{!bkbCadastroPessoaJuridica.orgaoEntidade}"
styleClass="envolveRadio"
valueChangeListener="#{actCadastroPessoaJuridica.selecaoCnpjNomeLst}"
onclick="setColorRadioGroupJSF();mudaInput('selectCodigoProcesso'); SetSel(selectCodigoProcesso);"
binding="#{actCadastroPessoaJuridica.selectRadioCnpj}">
<!-- Olá mundo -->
<f:selectItem itemValue="cnpj" id="codigoProcesso" itemLabel="" />
</t:selectOneRadio>
<t:selectOneRadio layout="pageDirection"
forceId="true" forceIdIndex="false" id="selectCodigoProcesso"
rendered="#{!bkbCadastroPessoaJuridica.orgaoEntidade}"
styleClass="envolveRadio"
valueChangeListener="#{actCadastroPessoaJuridica.selecaoCnpjNomeLst}"
onclick="setColorRadioGroupJSF();mudaInput('selectCodigoProcesso'); SetSel(selectCodigoProcesso);"
binding="#{actCadastroPessoaJuridica.selectRadioCnpj}">
<!-- Olá mundo -->
<f:selectItem itemValue="cnpj" id="codigoProcesso" itemLabel="" />
</t:selectOneRadio>
What code do you have so far? puts the change code();
– PauloHDSousa
Function mudaInput (nameRadio) {
 //alert("body on load mudaInput document.getElementById(nameRadio)"+document.getElementById(nameRadio));
 if(document.getElementById(nameRadio) != null){
 // alert("entrou mudaInput");
 var objects = document.getElementsByTagName("INPUT"); for (var i=0; i<Objects.length; i++) { thisElement = Objects[i];
– Ruan Nawe
if (thisElement.getattribute("type") == "radio") { // window.Alert (thisElement.name); //window.Alert (nameRadio); //Alert("thisElement.name"+thisElement.name); // Alert("nameRadio"+nameRadio); if (thisElement.checked && thisElement.name == nameRadio) { radioSelected = thisElement.value; } } }
– Ruan Nawe
var Objects = Document.getelementsbytagname("INPUT"); for (var i=0; i<Objects.length; i++) { var thisElement = Objects[i]; if (thisElement.getattribute("type") == "text") { if (radioSelected == "cnpj") { if (thisElement.id == "form:numero") { thisElement.disabled = false; } Else { //thisElement.disabled = true; }
– Ruan Nawe
} Else if (radioSelected == "name") { if (thisElement.id == "form:textText") { thisElement.disabled = false; } Else { //thisElement.disabled = true; } } } } } Else {
– Ruan Nawe
var Objects = Document.getelementsbytagname("INPUT"); for (var i=0; i<Objects.length; i++) { thisElement = Objects[i]; if (thisElement.getattribute("type") == "radio") { thisElement.checked = false; } } } } }
– Ruan Nawe
puts in question and not in comments.
– PauloHDSousa
Wouldn’t it be easier for you to change your HTML and instead of using Checkbox to use Radio buttons?? Radio buttons already have this function (deselect one when marking the other) natively.
– Renann Antunes