Código Javascript:
Ver original
function hide_show(){ residence_ownership_type = $("select#residence_ownership_type").val(); if(residence_ownership_type == "Arrendada"){ $("#showArrendada").show(); }else{ $("#showArrendada").hide(); $("input#telephone_no").val(''); $("input#cellphone_no").val(''); $("input#landlord_name").val(''); $("input#landlord_phone").val(''); }
Que me oculta estos campos
Código PHP:
Ver original
<?php if(isset($canidateBasicDetails['residence_ownership_type'])&&($canidateBasicDetails['residence_ownership_type'] == "Arrendada")){ $display=""; }else{ $display="none"; }?> <tr id="showArrendada" style="display:<?php echo $display;?>"> <td colspan="2"><table width="100%" border="00" cellspacing="00" cellpadding="00" class="bgcolor"> <tr> <td width="30%" align="left" valign="middle" height="40"><p>Si es arrendatario, nombre del arrendador </p></td> <td width="20%" align="left" valign="middle"><input type="text" name="landlord_name" id="landlord_name" value="<?php if(isset($canidateBasicDetails['landlord_name'])&&($canidateBasicDetails['landlord_name'] != "")){ echo $canidateBasicDetails['landlord_name']; }?>" autocomplete="off" /></td> <td width="30%" align="left" valign="middle"><p>Teléfono del arrendador </p></td> <td width="20%" align="left" valign="middle"><input type="text" name="landlord_phone" id="landlord_phone" value="<?php if(isset($canidateBasicDetails['landlord_phone'])&&($canidateBasicDetails['landlord_phone'] != "")){ echo $canidateBasicDetails['landlord_phone']; }?>" autocomplete="off" /></td> </tr> </table>
Lo que yo hice fue esto:
Código Javascript:
Ver original
function hide_show_family_type() { no_pople_living = $("input#no_pople_living").val(); if(no_pople_living == "0"){ $("#showRelacion").show(); }else{ $("#showRelacion").hide(); $("select#relationship_type_them").val(''); } }
Para que me oculte estos campos
Código PHP:
Ver original
<table> <?php if(isset($canidateBasicDetails['no_pople_living'])&&($canidateBasicDetails['no_pople_living'] == "0")){ $displayrelacion=""; }else{ $displayrelacion="none"; }?> <tr id="showRelacion" style="display:<?php echo $displayrelacion;?>"> <td align="left" valign="middle"><p><span class="error">*</span>Qué relación tiene con ellas? </p></td> <td width="15%" align="left" valign="middle"><p> <select name="relationship_type_them" id="relationship_type_them" class="select_mid"> <option selected="selected" value="" disabled="disabled">Seleccione</option> <option value="Familia" <?php if(isset($canidateBasicDetails['relationship_type_them'])&&($canidateBasicDetails['relationship_type_them'] == "Familia")){?> selected="selected" <?php }?>>Familia</option> <option value="Amigos" <?php if(isset($canidateBasicDetails['relationship_type_them'])&&($canidateBasicDetails['relationship_type_them'] == "Amigos")){?> selected="selected" <?php }?>>Amigos</option> <option value="Inquilinos" <?php if(isset($canidateBasicDetails['relationship_type_them'])&&($canidateBasicDetails['relationship_type_them'] == "Inquilinos")){?> selected="selected" <?php }?>>Inquilinos</option> </select> <span class="error" id="error_relationship_type_them" style="float:left"></span> </p> </td></tr></table> </tr> </table>
No se que pasa pero no me está tomando la condición, pues si le ingreso cero como valor muestra los campos y si ingreso otro valor tambien lo muestra.