Jump to content


  • Posts

  • Joined

  • Last visited

Previous Fields

  • Languages

Profile Information

  • Gender
  • Location
  • Interests
    PHP, MySQL, JavaScript, HTML

Nic's Achievements


Newbie (1/7)



  1. done! yessssssssss .. I got it! thank you both so much, any way. ...and no ID needed. It is runing perfectly. Now... just refining. Look at this: ...foreach($lista as $value){$equ_Id = $value['equ_Id'];$equ_Nome = $value['equ_Nome'];$equ_Est = $value['equ_Estoque'];echo "<tr><td><input type='checkbox' name='chEquName[]' onclick='mostrarCampo();' value="".$equ_Id."" />".$equ_Id." - ".$equ_Nome."</td> <td>Estoque :<input type='text' name='tfEst[]' size='4' value="".$equ_Est."" /></td> <td>Solicitada :<input type='text' name='tfQtSol[]' size='4' style='visibility:hidden;' maxlength='4' /></td> <td><input type='hidden' name='hProId' value="".$proId."" /></td></tr>";}=======================================================and the function...=======================================================case "f_Solicitacao_2":var ch = document.getElementsByName("chEquName[]");var tot = ch.length;for(var i = 0; i<tot; i++){if(ch[i].checked){var sol = document.getElementsByName("tfQtSol[]");sol[i].style.visibility="visible";}else{var sol = document.getElementsByName("tfQtSol[]");sol[i].value="";sol[i].style.visibility="hidden";}}break;
  2. O got nothing.. even changing the code. Please just let me know that it's possible to do what I need, so I will spend the rest of my days trying find the way. It doesn't run!!!
  3. Hi, friends, this is my first time here (sorry for my english). I have rpoblem in my code and I've tryed hard to solve it unsucessfully! I hope someone can help me...The problem: The form runs almost perfectly, except for the javascript function "mostrarCampo()". It should show an "imput field" each time I check the checkbox beside it. It happens that it shows only the first input. Here is the code: [background='light grey']//-----------------function Javasscript (in a file .js)------------------//function mostrarCampo(){ var nameForm = document.forms[0].name; switch (nameForm) { case "f_Ins_Suprimento": document.f_Ins_Suprimento.sClaNome.style.visibility="visible"; document.f_Ins_Suprimento.tfSupNome.style.visibility="visible"; document.f_Ins_Suprimento.tfSupEstoque.style.visibility="visible"; break; . . . case "f_Solicitacao_2": est = document.getElementsByName("tfEst[]"); for(var i = 0; i<est.length; i++){ document.f_Solicitacao_2.tfEst[i].style.visibility="visible"; } break; default: break; }}[/background] [background='light grey']//------------------THE FORM--------------------------------------------------//<!-- FORMULARIO DINÂMICO COM TRECHOS EM PHP QUE TRAZEM DADOS PARA SEREM MANIPULADOS --><form name="f_Solicitacao_2" action="index.php" method="post"><div align="center"><table id="tabRel"> <tr> <th colspan="4">SOLICITAÇÃO DE ALOCAÇÃO DE RECURSOS</th> </tr> <tr><td colspan='2'>Equipamentos</td><td>Estoque</td><td></td></tr><?php/*RESCUING A VRIABLE */ $proId = $_REQUEST['id'];/* CAPTURANDO E TRATANDO UMA EXCEPTION*/ try {/*GETTING DATA*/$lista = Equipamento::listarEquipamento();/*FOR EACH DATA IN ARRAY LIST, GET...*/foreach($lista as $value){$equ_Id = $value['equ_Id'];$equ_Nome = $value['equ_Nome'];$equ_Est = $value['equ_Estoque'];/*WRITTING IN SCREEN A TABLE WITH FOLLOWING ROWS* IN THE FIRST ROW, THE FUNCTION 'mostrarCampo() RUNS WHEN* THE CHECKBOX IS CHECKED AND SHOULD TURN "VISIBLE" THE "INPUT"* ON NEXT ROW */echo " <tr><td colspan='2'><input type='checkbox' id='chEquName' name='chEquName[]' onclick='mostrarCampo();' value="".$equ_Id."" />".$equ_Nome."</td> <td>Estoque :<input name='tfEst[]' id='tfEst[]' type='text' size='4' style='visibility:hidden;' value="".$equ_Est."" /></td> <td><input type='hidden' name='hProId' value="".$proId."" /></td></tr>";}/* CASO A EXCEÇÃO TENHA SIDO CAPTURADA, EXEBE MENSAGEM*/} catch (N_ListaVazia $exc) {echo $exc->getMessage();}?></table> <input type='hidden' name='hLabel' value='tela_Solicitacao_2' /> <p align="center"><input type="submit" name="bSubmit" value="confirmar"/></p><p align="center"><a href="?acao=tela_Servicos">VOLTAR</a></p><p align="center"><a href="?acao=logout">SAIR</a></p></div></form>[/background]
  • Create New...