Validação só funciona no IE no FF não acha o campo.
Pessoal tenho o seguinte script que valida alguns campos do meu formulário:
function valida_campos_inicial(){ conf = errorHead + "<ol>"; controle = false; if((document.getElementById("nome1").value == "") || (document.getElementById("nome1").value.substring(0,1) == " ")){ conf = conf + "\n <li>O campo NOME deve ser informado!</li>"; document.getElementById("nome1").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("e_mail").value == "") || (document.getElementById("e_mail").value.substring(0,1) == " ")){ conf = conf + "\n <li>O campo E-MAIL deve ser informado!</li>"; document.getElementById("e_mail").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("e_mail2").value == "") || (document.getElementById("e_mail2").value.substring(0,1) == " ")){ conf = conf + "\n <li>O campo CONFIRMAÇÃO DO E-MAIL deve ser informado!</li>"; document.getElementById("e_mail2").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("acesso").value == "") || (document.getElementById("acesso").value.substring(0,1) == " ")){ conf = conf + "\n <li>O campo ACESSO deve ser informado!</li>"; document.getElementById("acesso").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("senha").value == "") || (document.getElementById("senha").value.substring(0,1) == " ")){ conf = conf + "\n <li>O campo SENHA deve ser informado!</li>"; document.getElementById("senha").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("senha2").value == "") || (document.getElementById("senha2").value.substring(0,1) == " ")){ conf = conf + "\n <li>O campo CONFIRMAÇÃO DA SENHA deve ser informado!</li>"; document.getElementById("senha2").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("cpf").value == "") || (document.getElementById("cpf").value.substring(0,1) == " ")){ conf = conf + "\n <li>O campo CPF/CNPJ deve ser informado!</li>"; document.getElementById("cpf").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("e_mail").value != document.getElementById("e_mail2").value) || (document.getElementById("e_mail").value == "") || (document.getElementById("e_mail").value.substring(0, 1) == " ")){ conf = conf + "\n <li>Os campos E-MAIL e CONFIRMAÇÃO DE E-MAIL devem ser iguais!</li>"; document.getElementById("e_mail").style.backgroundColor = backGroundColor; document.getElementById("e_mail2").style.backgroundColor = backGroundColor; controle = true; } if((document.getElementById("senha").value != document.getElementById("senha2").value) || (document.getElementById("senha").value == "") || (document.getElementById("senha").value.substring(0, 1) == " ")){ conf = conf + "\n <li>Os campos SENHA e CONFIRMAÇÃO DA SENHA devem ser iguais!</li>"; document.getElementById("senha").style.backgroundColor = backGroundColor; document.getElementById("senha2").style.backgroundColor = backGroundColor; controle = true; } if(document.getElementById("senha").value.substring(5, 6) == ""){ conf = conf + "\n <li>O campo SENHA deve conter pelo menos 6 caracteres!</li>"; document.getElementById("senha").style.backgroundColor = backGroundColor; controle = true; } var email = document.getElementById("e_mail").value.indexOf("@"); var emailp = document.getElementById("e_mail").value.indexOf("."); if((email == -1) || (emailp == -1)){ conf = conf + "\n <li>O campo E-MAIL não contém um endereço de e-mail válido!</li>"; document.getElementById("e_mail").style.backgroundColor = backGroundColor; controle = true; } conf = conf + "</ol>" + errorButton; if (controle == true) { document.getElementById("erroLayer").style.display = "block"; document.getElementById("erroLayer").innerHTML = conf; document.getElementById("bodyOverlay").style.display = "block"; controle = false; return false; }}Na página tenho ainda as divs que serão apresentadas caso o erro exista:
<div id="erroLayer" style="display:none"></div> <div id="bodyOverlay" style="display:none"></div>Tenho também o CSS que formata essas divs da seguinte forma:
#erroLayer{position: fixed;left: 50%;width: 400px;margin-left: -200px;background-color: #FFD9D9;border: 2px solid #FF9D93;color: #000;padding: 0 0 5px 1em;font-family: "Trebuchet MS", Arial, sans-serif;font-size: small;text-align: left;z-index:1000;}#erroLayer h3{position:relative;background-color: #FF9D93;margin: 0 0 0.5em -0.5em;padding: 0.5em 1em;width:100%;}#erroLayer ol{margin: 0 0 5px;padding: 0;list-style-position: inside;list-style-type: decimal;line-height: 1.5em;}#erroLayer input{position:static;width: 65px;font-weight: bold;padding: 0px;font-family: "Trebuchet MS", Arial, sans-serif;margin: 0px;z-index:1500;}#erroLayerTitulo{width:101%;text-align:justify;padding:6px;margin:0px;margin-left:-14px;margin-bottom:3px;background-color:#FF9D93;z-index:1600;font-family:Arial, Helvetica, sans-serif;font-size:14px;font-weight:bold;}#erroLayerButton{width:65px;text-align:center;padding:7px;border:1px solid #FF9D93;left:50%;font-family:Arial, Helvetica, sans-serif;font-size:14px;font-weight:bold;background-color:#FF9D93;}#bodyOverlay{ position:fixed; left:0; top:0;width:120%;height:120%; background-color:#000000; z-index:500; filter:alpha(Opacity=60);-moz-opacity : 0.6;}
Erro: document.getElementById("nome1") has no propertiesArquivo-fonte: [url="http://souzen.bwilson.ind.br:8888/home/curriculum/i_rh_cur_cad_curriculo_pes_simple.php?tipo=1"][http://souzen.bwilson.ind.br:8888/home/cur...mple.php?tipo=1[/url]Linha:](http://souzen.bwilson.ind.br:8888/home/cur...mple.php?tipo=1%5B/url%5DLinha:) 35Será que alguém pode dar uma ajuda, já rodei a net e o fórum e não consegui nada para resolver o problema?
O link para teste é o seguinte (basta submeter a página sem preencher nenhum campo que terá que ativar a validação):
http://souzen.bwilson.ind.br:8888/home/cur...mple.php?tipo=1
Discussão (4)
Carregando comentários...